import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		long ans = 0;

		Scanner sc = new Scanner(System.in);
		int  n = sc.nextInt();
//		longd = sc.nextInt();
//
		boolean f = false;
		int[] array = new int [n+1];
		int[] array2 = new int[n];
		for (int i = 0; i < n+1; i++) {
			array[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			array2[i] = sc.nextInt();
		}

		long  tmp = 0;
		for (int i = 0; i < n+1; i++) {
			if(tmp > 0) {
				if(array[i]>=tmp) {
					ans = ans + tmp;
					array[i] = array[i] - (int)tmp;
				} else {
					ans = ans + array[i];
					array[i]=0;
				}
				tmp = 0;
			}
			if(i == n) {
				continue;
			}
			if(array[i] >= array2[i]) {
				ans = ans + array2[i];
				tmp = 0;
			} else {
				ans = ans + array[i];
				tmp  = (array2[i] - array[i]);
			}
//			System.out.println(ans);
		}

		System.out.println(ans);

		sc.close();
	}
}
/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