import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int MAX = 1000000002;
		ArrayList<Integer> monster = new ArrayList<Integer>();
		ArrayList<Integer> heroes = new ArrayList<Integer>();
		int n;
		long maximo = 0;
		n = reader.nextInt();
		for(int i=0; i<n+1; i++)
			monster.add(reader.nextInt());
		for(int i=0; i<n; i++)
			heroes.add(reader.nextInt());
		
		for(int i=0; i<n;i++) {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		}
		System.out.println(maximo);
	}

}

/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