import java.util.Scanner;

public class Main{
	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];
		long ans = 0;
		for(int i = 0; i < N + 1; i++) A[i] = sc.nextInt();
		for(int i = 0; i < N; i++) B[i] = sc.nextInt();

		for(int i = 0; i < N; i++) {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		}
		System.out.println(ans);
	}
} 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[] A = new int[N + 1];
		int[] B = new int[N];
		long ans = 0;
		for(int i = 0; i < N + 1; i++) A[i] = sc.nextInt();
		for(int i = 0; i < N; i++) B[i] = sc.nextInt();

		for(int i = 0; i < N; i++) {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		}
		System.out.println(ans);
	}
} Main 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];
		long ans = 0;
		for(int i = 0; i < N + 1; i++) A[i] = sc.nextInt();
		for(int i = 0; i < N; i++) B[i] = sc.nextInt();

		for(int i = 0; i < N; i++) {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		}
		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];
		long ans = 0;
		for(int i = 0; i < N + 1; i++) A[i] = sc.nextInt();
		for(int i = 0; i < N; i++) B[i] = sc.nextInt();

		for(int i = 0; i < N; i++) {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		}
		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 long ans = 0; ans 0 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 for(int i = 0; i < N; i++) {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		} {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		} long killi = (A[i] >= B[i]) ? B[i] : A[i]; killi (A[i] >= B[i]) ? B[i] : A[i] (A[i] >= B[i]) A[i] A i B[i] B i B[i] B i A[i] A i ans += killi ans killi A[i] -= killi A[i] A i killi B[i] -= killi B[i] B i killi long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1]; killii (A[i + 1] >= B[i]) ? B[i] : A[i + 1] (A[i + 1] >= B[i]) A[i + 1] A i + 1 i 1 B[i] B i B[i] B i A[i + 1] A i + 1 i 1 ans += killii ans killii A[i + 1] -= killii A[i + 1] A i + 1 i 1 killii B[i] -= killii B[i] B i killii System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
	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];
		long ans = 0;
		for(int i = 0; i < N + 1; i++) A[i] = sc.nextInt();
		for(int i = 0; i < N; i++) B[i] = sc.nextInt();

		for(int i = 0; i < N; i++) {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		}
		System.out.println(ans);
	}
} public class Main{
	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];
		long ans = 0;
		for(int i = 0; i < N + 1; i++) A[i] = sc.nextInt();
		for(int i = 0; i < N; i++) B[i] = sc.nextInt();

		for(int i = 0; i < N; i++) {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		}
		System.out.println(ans);
	}
} 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[] A = new int[N + 1];
		int[] B = new int[N];
		long ans = 0;
		for(int i = 0; i < N + 1; i++) A[i] = sc.nextInt();
		for(int i = 0; i < N; i++) B[i] = sc.nextInt();

		for(int i = 0; i < N; i++) {
			/* B[i] */
			// A[i]
			long killi = (A[i] >= B[i]) ? B[i] : A[i];
			ans += killi;
			A[i] -= killi; B[i] -= killi;

			// A[i + 1]
			long killii = (A[i + 1] >= B[i]) ? B[i] : A[i + 1];
			ans += killii;
			A[i + 1] -= killii; B[i] -= killii;
		}
		System.out.println(ans);
	}
}