import java.util.*;

class Main{
public static void main(String[] args){
	long count = 0;
	Scanner scan = new Scanner(System.in);
	int num = scan.nextInt();//町の数
	long[] mons = new long[num+1];//n-1番目の街のモンスター数
	long[] yusya = new long[num];//n-1番目の勇者が倒せるモンスターの数
	for(int i = 0;i<num+1;i++){
		mons[i]=Long.parseLong(scan.next());
	}
	for(int i = 0;i<num;i++){
		yusya[i]=Long.parseLong(scan.next());
	}

	for(int i = 0;i<num;i++){
		if(mons[i]>=yusya[i])count+=yusya[i];
		else if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		}
	}

	System.out.println(count);
}

} import java.util.*; util.* java class Main{
public static void main(String[] args){
	long count = 0;
	Scanner scan = new Scanner(System.in);
	int num = scan.nextInt();//町の数
	long[] mons = new long[num+1];//n-1番目の街のモンスター数
	long[] yusya = new long[num];//n-1番目の勇者が倒せるモンスターの数
	for(int i = 0;i<num+1;i++){
		mons[i]=Long.parseLong(scan.next());
	}
	for(int i = 0;i<num;i++){
		yusya[i]=Long.parseLong(scan.next());
	}

	for(int i = 0;i<num;i++){
		if(mons[i]>=yusya[i])count+=yusya[i];
		else if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		}
	}

	System.out.println(count);
}

} Main public static void main(String[] args){
	long count = 0;
	Scanner scan = new Scanner(System.in);
	int num = scan.nextInt();//町の数
	long[] mons = new long[num+1];//n-1番目の街のモンスター数
	long[] yusya = new long[num];//n-1番目の勇者が倒せるモンスターの数
	for(int i = 0;i<num+1;i++){
		mons[i]=Long.parseLong(scan.next());
	}
	for(int i = 0;i<num;i++){
		yusya[i]=Long.parseLong(scan.next());
	}

	for(int i = 0;i<num;i++){
		if(mons[i]>=yusya[i])count+=yusya[i];
		else if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		}
	}

	System.out.println(count);
} main {
	long count = 0;
	Scanner scan = new Scanner(System.in);
	int num = scan.nextInt();//町の数
	long[] mons = new long[num+1];//n-1番目の街のモンスター数
	long[] yusya = new long[num];//n-1番目の勇者が倒せるモンスターの数
	for(int i = 0;i<num+1;i++){
		mons[i]=Long.parseLong(scan.next());
	}
	for(int i = 0;i<num;i++){
		yusya[i]=Long.parseLong(scan.next());
	}

	for(int i = 0;i<num;i++){
		if(mons[i]>=yusya[i])count+=yusya[i];
		else if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		}
	}

	System.out.println(count);
} long count = 0; count 0 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan long[] mons = new long[num+1]; mons new long[num+1] num+1 num 1 long[] yusya = new long[num]; yusya new long[num] num for(int i = 0;i<num+1;i++){
		mons[i]=Long.parseLong(scan.next());
	} int i = 0; int i = 0; i 0 i<num+1 i num+1 num 1 i++ i++ i {
		mons[i]=Long.parseLong(scan.next());
	} {
		mons[i]=Long.parseLong(scan.next());
	} mons[i]=Long.parseLong(scan.next()) mons[i] mons i Long.parseLong(scan.next()) Long.parseLong Long scan.next() scan.next scan for(int i = 0;i<num;i++){
		yusya[i]=Long.parseLong(scan.next());
	} int i = 0; int i = 0; i 0 i<num i num i++ i++ i {
		yusya[i]=Long.parseLong(scan.next());
	} {
		yusya[i]=Long.parseLong(scan.next());
	} yusya[i]=Long.parseLong(scan.next()) yusya[i] yusya i Long.parseLong(scan.next()) Long.parseLong Long scan.next() scan.next scan for(int i = 0;i<num;i++){
		if(mons[i]>=yusya[i])count+=yusya[i];
		else if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		}
	} int i = 0; int i = 0; i 0 i<num i num i++ i++ i {
		if(mons[i]>=yusya[i])count+=yusya[i];
		else if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		}
	} {
		if(mons[i]>=yusya[i])count+=yusya[i];
		else if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		}
	} if(mons[i]>=yusya[i])count+=yusya[i];
		else if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		} mons[i]>=yusya[i] mons[i] mons i yusya[i] yusya i count+=yusya[i] count yusya[i] yusya i if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		} (mons[i]+mons[i+1])<=yusya[i] (mons[i]+mons[i+1]) mons[i] mons i mons[i+1] mons i+1 i 1 yusya[i] yusya i {
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		} count+=mons[i]+mons[i+1] count mons[i]+mons[i+1] mons[i] mons i mons[i+1] mons i+1 i 1 mons[i+1]=0 mons[i+1] mons i+1 i 1 0 if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		} mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1]) mons[i]<yusya[i] mons[i] mons i yusya[i] yusya i yusya[i]<(mons[i]+mons[i+1]) yusya[i] yusya i (mons[i]+mons[i+1]) mons[i] mons i mons[i+1] mons i+1 i 1 {
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		} count+=yusya[i] count yusya[i] yusya i mons[i+1]-=(yusya[i]-mons[i]) mons[i+1] mons i+1 i 1 (yusya[i]-mons[i]) yusya[i] yusya i mons[i] mons i System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.*;

class Main{
public static void main(String[] args){
	long count = 0;
	Scanner scan = new Scanner(System.in);
	int num = scan.nextInt();//町の数
	long[] mons = new long[num+1];//n-1番目の街のモンスター数
	long[] yusya = new long[num];//n-1番目の勇者が倒せるモンスターの数
	for(int i = 0;i<num+1;i++){
		mons[i]=Long.parseLong(scan.next());
	}
	for(int i = 0;i<num;i++){
		yusya[i]=Long.parseLong(scan.next());
	}

	for(int i = 0;i<num;i++){
		if(mons[i]>=yusya[i])count+=yusya[i];
		else if((mons[i]+mons[i+1])<=yusya[i]){
			count+=mons[i]+mons[i+1];
			mons[i+1]=0;
		}else if(mons[i]<yusya[i]&&yusya[i]<(mons[i]+mons[i+1])){
			count+=yusya[i];
			mons[i+1]-=(yusya[i]-mons[i]);
		}
	}

	System.out.println(count);
}

}