import java.util.*;
public class Main {
	
	static int mod = (int)1e9+7;
	
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N+1];
		int B[] = new int[N];
		for(int i=0;i<N+1;i++)A[i]=sc.nextInt();
		for(int i=0;i<N;i++)B[i]=sc.nextInt();
		sc.close();
		long ans = 0;
		for(int i=0;i<N;i++) {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	
	static int mod = (int)1e9+7;
	
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N+1];
		int B[] = new int[N];
		for(int i=0;i<N+1;i++)A[i]=sc.nextInt();
		for(int i=0;i<N;i++)B[i]=sc.nextInt();
		sc.close();
		long ans = 0;
		for(int i=0;i<N;i++) {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		}
		System.out.println(ans);
	}
} Main static int mod = (int)1e9+7; mod (int)1e9+7 (int)1e9 7 public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N+1];
		int B[] = new int[N];
		for(int i=0;i<N+1;i++)A[i]=sc.nextInt();
		for(int i=0;i<N;i++)B[i]=sc.nextInt();
		sc.close();
		long ans = 0;
		for(int i=0;i<N;i++) {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		}
		System.out.println(ans);
	} main {		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N+1];
		int B[] = new int[N];
		for(int i=0;i<N+1;i++)A[i]=sc.nextInt();
		for(int i=0;i<N;i++)B[i]=sc.nextInt();
		sc.close();
		long ans = 0;
		for(int i=0;i<N;i++) {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int A[] = new int[N+1]; A new int[N+1] N+1 N 1 int B[] = new int[N]; B new int[N] N for(int i=0;i<N+1;i++)A[i]=sc.nextInt(); int i=0; int i=0; i 0 i<N+1 i N+1 N 1 i++ i++ i A[i]=sc.nextInt(); A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc for(int i=0;i<N;i++)B[i]=sc.nextInt(); int i=0; int i=0; i 0 i<N i N i++ i++ i B[i]=sc.nextInt(); B[i]=sc.nextInt() B[i] B i sc.nextInt() sc.nextInt sc sc.close() sc.close sc long ans = 0; ans 0 for(int i=0;i<N;i++) {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		} {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		} if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			} B[i]>A[i] B[i] B i A[i] A i {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			} ans += A[i] ans A[i] A i int remain = B[i]-A[i]; remain B[i]-A[i] B[i] B i A[i] A i int nextBeat = Math.min(A[i+1], remain); nextBeat Math.min(A[i+1], remain) Math.min Math A[i+1] A i+1 i 1 remain ans += nextBeat ans nextBeat A[i+1] -= nextBeat A[i+1] A i+1 i 1 nextBeat {
				ans += B[i];
			} ans += B[i] ans B[i] B i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	
	static int mod = (int)1e9+7;
	
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N+1];
		int B[] = new int[N];
		for(int i=0;i<N+1;i++)A[i]=sc.nextInt();
		for(int i=0;i<N;i++)B[i]=sc.nextInt();
		sc.close();
		long ans = 0;
		for(int i=0;i<N;i++) {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		}
		System.out.println(ans);
	}
} public class Main {
	
	static int mod = (int)1e9+7;
	
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N+1];
		int B[] = new int[N];
		for(int i=0;i<N+1;i++)A[i]=sc.nextInt();
		for(int i=0;i<N;i++)B[i]=sc.nextInt();
		sc.close();
		long ans = 0;
		for(int i=0;i<N;i++) {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
public class Main {
	
	static int mod = (int)1e9+7;
	
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N+1];
		int B[] = new int[N];
		for(int i=0;i<N+1;i++)A[i]=sc.nextInt();
		for(int i=0;i<N;i++)B[i]=sc.nextInt();
		sc.close();
		long ans = 0;
		for(int i=0;i<N;i++) {
			if(B[i]>A[i]) {
				ans += A[i];
				int remain = B[i]-A[i];
				//余力で次の町
				int nextBeat = Math.min(A[i+1], remain);
				ans += nextBeat;
				A[i+1] -= nextBeat;

			}else {
				ans += B[i];
			}
		}
		System.out.println(ans);
	}
}