import java.io.*;
import java.math.BigInteger;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] monsters = new int[n+1];
		int i;
		for(i=0; i<=n; i++)
			monsters[i] = Integer.parseInt(line[i]);
		line = br.readLine().split(" ");
		int[] braves = new int[n];
		for(i=0; i<n; i++)
			braves[i] = Integer.parseInt(line[i]);
		
		BigInteger count = BigInteger.ZERO;
		int tmp, killed;
		for(i=0; i<n; i++){
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		}
		System.out.println(count);
	}
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz