import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] numMonsters = new int[N+1];
		int[] capasityHero = new int[N];		
		for(int i=0;i<N+1;i++) {
			numMonsters[i] = sc.nextInt();
		}		
		for(int i=0;i<N; i++) {
			capasityHero[i] = sc.nextInt();
		}
		
		long sum = 0;
		for(int i=0;i<N;i++) {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		}
		
		System.out.println(sum);
		
		sc.close();	
	}
 
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] numMonsters = new int[N+1];
		int[] capasityHero = new int[N];		
		for(int i=0;i<N+1;i++) {
			numMonsters[i] = sc.nextInt();
		}		
		for(int i=0;i<N; i++) {
			capasityHero[i] = sc.nextInt();
		}
		
		long sum = 0;
		for(int i=0;i<N;i++) {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		}
		
		System.out.println(sum);
		
		sc.close();	
	}
 
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] numMonsters = new int[N+1];
		int[] capasityHero = new int[N];		
		for(int i=0;i<N+1;i++) {
			numMonsters[i] = sc.nextInt();
		}		
		for(int i=0;i<N; i++) {
			capasityHero[i] = sc.nextInt();
		}
		
		long sum = 0;
		for(int i=0;i<N;i++) {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		}
		
		System.out.println(sum);
		
		sc.close();	
	} main {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] numMonsters = new int[N+1];
		int[] capasityHero = new int[N];		
		for(int i=0;i<N+1;i++) {
			numMonsters[i] = sc.nextInt();
		}		
		for(int i=0;i<N; i++) {
			capasityHero[i] = sc.nextInt();
		}
		
		long sum = 0;
		for(int i=0;i<N;i++) {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		}
		
		System.out.println(sum);
		
		sc.close();	
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] numMonsters = new int[N+1]; numMonsters new int[N+1] N+1 N 1 int[] capasityHero = new int[N]; capasityHero new int[N] N for(int i=0;i<N+1;i++) {
			numMonsters[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N+1 i N+1 N 1 i++ i++ i {
			numMonsters[i] = sc.nextInt();
		} {
			numMonsters[i] = sc.nextInt();
		} numMonsters[i] = sc.nextInt() numMonsters[i] numMonsters i sc.nextInt() sc.nextInt sc for(int i=0;i<N; i++) {
			capasityHero[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			capasityHero[i] = sc.nextInt();
		} {
			capasityHero[i] = sc.nextInt();
		} capasityHero[i] = sc.nextInt() capasityHero[i] capasityHero i sc.nextInt() sc.nextInt sc long sum = 0; sum 0 for(int i=0;i<N;i++) {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		} {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		} sum += Math.min(numMonsters[i], capasityHero[i]) sum Math.min(numMonsters[i], capasityHero[i]) Math.min Math numMonsters[i] numMonsters i capasityHero[i] capasityHero i int extra = Math.max(0, capasityHero[i] - numMonsters[i]); extra Math.max(0, capasityHero[i] - numMonsters[i]) Math.max Math 0 capasityHero[i] - numMonsters[i] capasityHero[i] capasityHero i numMonsters[i] numMonsters i sum += Math.min(numMonsters[i+1], extra) sum Math.min(numMonsters[i+1], extra) Math.min Math numMonsters[i+1] numMonsters i+1 i 1 extra numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra) numMonsters[i+1] numMonsters i+1 i 1 Math.max(0, numMonsters[i+1] - extra) Math.max Math 0 numMonsters[i+1] - extra numMonsters[i+1] numMonsters i+1 i 1 extra System.out.println(sum) System.out.println System.out System System.out sum sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] numMonsters = new int[N+1];
		int[] capasityHero = new int[N];		
		for(int i=0;i<N+1;i++) {
			numMonsters[i] = sc.nextInt();
		}		
		for(int i=0;i<N; i++) {
			capasityHero[i] = sc.nextInt();
		}
		
		long sum = 0;
		for(int i=0;i<N;i++) {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		}
		
		System.out.println(sum);
		
		sc.close();	
	}
 
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] numMonsters = new int[N+1];
		int[] capasityHero = new int[N];		
		for(int i=0;i<N+1;i++) {
			numMonsters[i] = sc.nextInt();
		}		
		for(int i=0;i<N; i++) {
			capasityHero[i] = sc.nextInt();
		}
		
		long sum = 0;
		for(int i=0;i<N;i++) {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		}
		
		System.out.println(sum);
		
		sc.close();	
	}
 
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] numMonsters = new int[N+1];
		int[] capasityHero = new int[N];		
		for(int i=0;i<N+1;i++) {
			numMonsters[i] = sc.nextInt();
		}		
		for(int i=0;i<N; i++) {
			capasityHero[i] = sc.nextInt();
		}
		
		long sum = 0;
		for(int i=0;i<N;i++) {
			sum += Math.min(numMonsters[i], capasityHero[i]);
			int extra = Math.max(0, capasityHero[i] - numMonsters[i]);
			sum += Math.min(numMonsters[i+1], extra);
			numMonsters[i+1] =  Math.max(0, numMonsters[i+1] - extra);
		}
		
		System.out.println(sum);
		
		sc.close();	
	}
 
}