import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      	PrintWriter out = new PrintWriter(System.out);
      	int N = sc.nextInt();
      	int[] monsters = new int[N + 1];
      	int[] strength = new int[N];
      	for (int i = 0; i < N + 1; i++) {
        	monsters[i] = sc.nextInt(); 
        }
      	for (int i = 0; i < N; i++) {
        	strength[i] = sc.nextInt(); 
        }
      	long total = 0;
      	for (int i = N - 1; i >= 0; i--) {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        }
      	out.println(total);
      	out.close();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      	PrintWriter out = new PrintWriter(System.out);
      	int N = sc.nextInt();
      	int[] monsters = new int[N + 1];
      	int[] strength = new int[N];
      	for (int i = 0; i < N + 1; i++) {
        	monsters[i] = sc.nextInt(); 
        }
      	for (int i = 0; i < N; i++) {
        	strength[i] = sc.nextInt(); 
        }
      	long total = 0;
      	for (int i = N - 1; i >= 0; i--) {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        }
      	out.println(total);
      	out.close();
    }
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      	PrintWriter out = new PrintWriter(System.out);
      	int N = sc.nextInt();
      	int[] monsters = new int[N + 1];
      	int[] strength = new int[N];
      	for (int i = 0; i < N + 1; i++) {
        	monsters[i] = sc.nextInt(); 
        }
      	for (int i = 0; i < N; i++) {
        	strength[i] = sc.nextInt(); 
        }
      	long total = 0;
      	for (int i = N - 1; i >= 0; i--) {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        }
      	out.println(total);
      	out.close();
    } main {
		Scanner sc = new Scanner(System.in);
      	PrintWriter out = new PrintWriter(System.out);
      	int N = sc.nextInt();
      	int[] monsters = new int[N + 1];
      	int[] strength = new int[N];
      	for (int i = 0; i < N + 1; i++) {
        	monsters[i] = sc.nextInt(); 
        }
      	for (int i = 0; i < N; i++) {
        	strength[i] = sc.nextInt(); 
        }
      	long total = 0;
      	for (int i = N - 1; i >= 0; i--) {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        }
      	out.println(total);
      	out.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] monsters = new int[N + 1]; monsters new int[N + 1] N + 1 N 1 int[] strength = new int[N]; strength new int[N] N for (int i = 0; i < N + 1; i++) {
        	monsters[i] = sc.nextInt(); 
        } int i = 0; int i = 0; i 0 i < N + 1 i N + 1 N 1 i++ i++ i {
        	monsters[i] = sc.nextInt(); 
        } {
        	monsters[i] = sc.nextInt(); 
        } monsters[i] = sc.nextInt() monsters[i] monsters i sc.nextInt() sc.nextInt sc for (int i = 0; i < N; i++) {
        	strength[i] = sc.nextInt(); 
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
        	strength[i] = sc.nextInt(); 
        } {
        	strength[i] = sc.nextInt(); 
        } strength[i] = sc.nextInt() strength[i] strength i sc.nextInt() sc.nextInt sc long total = 0; total 0 for (int i = N - 1; i >= 0; i--) {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        } int i = N - 1; int i = N - 1; i N - 1 N 1 i >= 0 i 0 i-- i-- i {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        } {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        } int killedFirst = Math.min(monsters[i + 1], strength[i]); killedFirst Math.min(monsters[i + 1], strength[i]) Math.min Math monsters[i + 1] monsters i + 1 i 1 strength[i] strength i strength[i] -= killedFirst strength[i] strength i killedFirst int killedSecond = Math.min(strength[i], monsters[i]); killedSecond Math.min(strength[i], monsters[i]) Math.min Math strength[i] strength i monsters[i] monsters i monsters[i] -= killedSecond monsters[i] monsters i killedSecond total += (killedFirst + killedSecond) total (killedFirst + killedSecond) killedFirst killedSecond out.println(total) out.println out total out.close() out.close out String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      	PrintWriter out = new PrintWriter(System.out);
      	int N = sc.nextInt();
      	int[] monsters = new int[N + 1];
      	int[] strength = new int[N];
      	for (int i = 0; i < N + 1; i++) {
        	monsters[i] = sc.nextInt(); 
        }
      	for (int i = 0; i < N; i++) {
        	strength[i] = sc.nextInt(); 
        }
      	long total = 0;
      	for (int i = N - 1; i >= 0; i--) {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        }
      	out.println(total);
      	out.close();
    }
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      	PrintWriter out = new PrintWriter(System.out);
      	int N = sc.nextInt();
      	int[] monsters = new int[N + 1];
      	int[] strength = new int[N];
      	for (int i = 0; i < N + 1; i++) {
        	monsters[i] = sc.nextInt(); 
        }
      	for (int i = 0; i < N; i++) {
        	strength[i] = sc.nextInt(); 
        }
      	long total = 0;
      	for (int i = N - 1; i >= 0; i--) {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        }
      	out.println(total);
      	out.close();
    }
} Main
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      	PrintWriter out = new PrintWriter(System.out);
      	int N = sc.nextInt();
      	int[] monsters = new int[N + 1];
      	int[] strength = new int[N];
      	for (int i = 0; i < N + 1; i++) {
        	monsters[i] = sc.nextInt(); 
        }
      	for (int i = 0; i < N; i++) {
        	strength[i] = sc.nextInt(); 
        }
      	long total = 0;
      	for (int i = N - 1; i >= 0; i--) {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        }
      	out.println(total);
      	out.close();
    }
}