import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long tmp=0L;
		long[] town =new long[N+1];
		for(int i=0; i<N+1; i++) {
			town[i]=sc.nextLong();
		}
		long[] sensi=new long[N];
		for(int i=0; i<N; i++) {
			sensi[i]=sc.nextLong();
		}
		for(int i=0; i<N; i++) {
			if(sensi[i]>=town[i]) {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			}
			else {
				tmp+=sensi[i];
				sensi[i]=0;
			}
		}
		tmp+=Math.min(town[N],sensi[N-1]);
		p(tmp);

	}
	public static void p(Object o) {
		System.out.println(o);
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long tmp=0L;
		long[] town =new long[N+1];
		for(int i=0; i<N+1; i++) {
			town[i]=sc.nextLong();
		}
		long[] sensi=new long[N];
		for(int i=0; i<N; i++) {
			sensi[i]=sc.nextLong();
		}
		for(int i=0; i<N; i++) {
			if(sensi[i]>=town[i]) {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			}
			else {
				tmp+=sensi[i];
				sensi[i]=0;
			}
		}
		tmp+=Math.min(town[N],sensi[N-1]);
		p(tmp);

	}
	public static void p(Object o) {
		System.out.println(o);
	}
} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long tmp=0L;
		long[] town =new long[N+1];
		for(int i=0; i<N+1; i++) {
			town[i]=sc.nextLong();
		}
		long[] sensi=new long[N];
		for(int i=0; i<N; i++) {
			sensi[i]=sc.nextLong();
		}
		for(int i=0; i<N; i++) {
			if(sensi[i]>=town[i]) {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			}
			else {
				tmp+=sensi[i];
				sensi[i]=0;
			}
		}
		tmp+=Math.min(town[N],sensi[N-1]);
		p(tmp);

	} main {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long tmp=0L;
		long[] town =new long[N+1];
		for(int i=0; i<N+1; i++) {
			town[i]=sc.nextLong();
		}
		long[] sensi=new long[N];
		for(int i=0; i<N; i++) {
			sensi[i]=sc.nextLong();
		}
		for(int i=0; i<N; i++) {
			if(sensi[i]>=town[i]) {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			}
			else {
				tmp+=sensi[i];
				sensi[i]=0;
			}
		}
		tmp+=Math.min(town[N],sensi[N-1]);
		p(tmp);

	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc long tmp=0L; tmp 0L long[] town =new long[N+1]; town new long[N+1] N+1 N 1 for(int i=0; i<N+1; i++) {
			town[i]=sc.nextLong();
		} int i=0; int i=0; i 0 i<N+1 i N+1 N 1 i++ i++ i {
			town[i]=sc.nextLong();
		} {
			town[i]=sc.nextLong();
		} town[i]=sc.nextLong() town[i] town i sc.nextLong() sc.nextLong sc long[] sensi=new long[N]; sensi new long[N] N for(int i=0; i<N; i++) {
			sensi[i]=sc.nextLong();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			sensi[i]=sc.nextLong();
		} {
			sensi[i]=sc.nextLong();
		} sensi[i]=sc.nextLong() sensi[i] sensi i sc.nextLong() sc.nextLong sc for(int i=0; i<N; i++) {
			if(sensi[i]>=town[i]) {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			}
			else {
				tmp+=sensi[i];
				sensi[i]=0;
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			if(sensi[i]>=town[i]) {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			}
			else {
				tmp+=sensi[i];
				sensi[i]=0;
			}
		} {
			if(sensi[i]>=town[i]) {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			}
			else {
				tmp+=sensi[i];
				sensi[i]=0;
			}
		} if(sensi[i]>=town[i]) {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			}
			else {
				tmp+=sensi[i];
				sensi[i]=0;
			} sensi[i]>=town[i] sensi[i] sensi i town[i] town i {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			} tmp+=town[i] tmp town[i] town i sensi[i]-=town[i] sensi[i] sensi i town[i] town i if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				} sensi[i]>0 sensi[i] sensi i 0 {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				} if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					} sensi[i]>=town[i+1] sensi[i] sensi i town[i+1] town i+1 i 1 {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					} tmp+=town[i+1] tmp town[i+1] town i+1 i 1 sensi[i]-=town[i+1] sensi[i] sensi i town[i+1] town i+1 i 1 town[i+1]=0 town[i+1] town i+1 i 1 0 {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					} tmp+=sensi[i] tmp sensi[i] sensi i town[i+1]-=sensi[i] town[i+1] town i+1 i 1 sensi[i] sensi i sensi[i]=0 sensi[i] sensi i 0 {
				tmp+=sensi[i];
				sensi[i]=0;
			} tmp+=sensi[i] tmp sensi[i] sensi i sensi[i]=0 sensi[i] sensi i 0 tmp+=Math.min(town[N],sensi[N-1]) tmp Math.min(town[N],sensi[N-1]) Math.min Math town[N] town N sensi[N-1] sensi N-1 N 1 p(tmp) p tmp String[] args args public static void p(Object o) {
		System.out.println(o);
	} p {
		System.out.println(o);
	} System.out.println(o) System.out.println System.out System System.out o Object o o
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long tmp=0L;
		long[] town =new long[N+1];
		for(int i=0; i<N+1; i++) {
			town[i]=sc.nextLong();
		}
		long[] sensi=new long[N];
		for(int i=0; i<N; i++) {
			sensi[i]=sc.nextLong();
		}
		for(int i=0; i<N; i++) {
			if(sensi[i]>=town[i]) {
				tmp+=town[i];
				sensi[i]-=town[i];
				if(sensi[i]>0) {
					if(sensi[i]>=town[i+1]) {
						tmp+=town[i+1];
						sensi[i]-=town[i+1];
						town[i+1]=0;
					}
					else {
						tmp+=sensi[i];
						town[i+1]-=sensi[i];
						sensi[i]=0;
					}
				}
			}
			else {
				tmp+=sensi[i];
				sensi[i]=0;
			}
		}
		tmp+=Math.min(town[N],sensi[N-1]);
		p(tmp);

	}
	public static void p(Object o) {
		System.out.println(o);
	}
}