import java.util.*;
public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = Integer.parseInt(sc.next());
	long[] listA = new long[n+1];
	long[] listB = new long[n];
	for(int i =0; i<n+1; i++) {
			listA[i] = Integer.parseInt(sc.next());
	}
	for(int i =0; i<n; i++) {
			listB[i] = Integer.parseInt(sc.next());
	}

	long sum =0;
	long power = 0;
	long least = listA[n];
	for(int i=n; i>=1; i--) {
		if(least<listB[i-1]) {
			sum = sum + least;
			power = listB[i-1] - least;
		}else {
			sum = sum + listB[i-1];
			power = 0;
		}

		least = listA[i-1] - power;
		if(least<0) {
			least = 0;
			sum = sum + listA[i-1];
		}else {
			sum = sum + power;
		}
		
	}
	

	System.out.println(sum);
	}
}
/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