import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		long[] b = new long[x + 1];
		long[] a = new long[x];
		for (int i = 0; i < x + 1; i++) b[i] = sc.nextLong();
		for(int i = 0;i<x;i++)a[i]=sc.nextLong();
		long output = 0;
		for(int i = 0;i<x;i++) {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		}
		System.out.println(output);
		
	}
} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		long[] b = new long[x + 1];
		long[] a = new long[x];
		for (int i = 0; i < x + 1; i++) b[i] = sc.nextLong();
		for(int i = 0;i<x;i++)a[i]=sc.nextLong();
		long output = 0;
		for(int i = 0;i<x;i++) {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		}
		System.out.println(output);
		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		long[] b = new long[x + 1];
		long[] a = new long[x];
		for (int i = 0; i < x + 1; i++) b[i] = sc.nextLong();
		for(int i = 0;i<x;i++)a[i]=sc.nextLong();
		long output = 0;
		for(int i = 0;i<x;i++) {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		}
		System.out.println(output);
		
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		long[] b = new long[x + 1];
		long[] a = new long[x];
		for (int i = 0; i < x + 1; i++) b[i] = sc.nextLong();
		for(int i = 0;i<x;i++)a[i]=sc.nextLong();
		long output = 0;
		for(int i = 0;i<x;i++) {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		}
		System.out.println(output);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc long[] b = new long[x + 1]; b new long[x + 1] x + 1 x 1 long[] a = new long[x]; a new long[x] x for (int i = 0; i < x + 1; i++) b[i] = sc.nextLong(); int i = 0; int i = 0; i 0 i < x + 1 i x + 1 x 1 i++ i++ i b[i] = sc.nextLong(); b[i] = sc.nextLong() b[i] b i sc.nextLong() sc.nextLong sc for(int i = 0;i<x;i++)a[i]=sc.nextLong(); int i = 0; int i = 0; i 0 i<x i x i++ i++ i a[i]=sc.nextLong(); a[i]=sc.nextLong() a[i] a i sc.nextLong() sc.nextLong sc long output = 0; output 0 for(int i = 0;i<x;i++) {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		} int i = 0; int i = 0; i 0 i<x i x i++ i++ i {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		} {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		} long v = Math.min(a[i],b[i]); v Math.min(a[i],b[i]) Math.min Math a[i] a i b[i] b i a[i]-=v a[i] a i v b[i]-=v b[i] b i v output+=v output v v=Math.min(a[i],b[i+1]) v Math.min(a[i],b[i+1]) Math.min Math a[i] a i b[i+1] b i+1 i 1 a[i]-=v a[i] a i v b[i+1]-=v b[i+1] b i+1 i 1 v output+=v output v System.out.println(output) System.out.println System.out System System.out output String[] args args public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		long[] b = new long[x + 1];
		long[] a = new long[x];
		for (int i = 0; i < x + 1; i++) b[i] = sc.nextLong();
		for(int i = 0;i<x;i++)a[i]=sc.nextLong();
		long output = 0;
		for(int i = 0;i<x;i++) {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		}
		System.out.println(output);
		
	}
} public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		long[] b = new long[x + 1];
		long[] a = new long[x];
		for (int i = 0; i < x + 1; i++) b[i] = sc.nextLong();
		for(int i = 0;i<x;i++)a[i]=sc.nextLong();
		long output = 0;
		for(int i = 0;i<x;i++) {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		}
		System.out.println(output);
		
	}
} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		long[] b = new long[x + 1];
		long[] a = new long[x];
		for (int i = 0; i < x + 1; i++) b[i] = sc.nextLong();
		for(int i = 0;i<x;i++)a[i]=sc.nextLong();
		long output = 0;
		for(int i = 0;i<x;i++) {
			long v = Math.min(a[i],b[i]);
			a[i]-=v;
			b[i]-=v;
			output+=v;
			v=Math.min(a[i],b[i+1]);
			a[i]-=v;
			b[i+1]-=v;
			output+=v;
		}
		System.out.println(output);
		
	}
}
