import 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 + 1];
		for (int i = 0; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		b[n] = 0;
		sc.close();
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		}
		System.out.println(ans);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
} import java.util.*; util.* java 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 + 1];
		for (int i = 0; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		b[n] = 0;
		sc.close();
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		}
		System.out.println(ans);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
} 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 + 1];
		for (int i = 0; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		b[n] = 0;
		sc.close();
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		}
		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 + 1];
		for (int i = 0; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		b[n] = 0;
		sc.close();
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		}
		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 + 1]; b new int[n + 1] n + 1 n 1 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] = 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] = sc.nextInt() b[i] b i sc.nextInt() sc.nextInt sc b[n] = 0 b[n] b n 0 sc.close() sc.close sc long ans = 0; ans 0 for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		} {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		} if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			} a[i] > b[i] a[i] a i b[i] b i {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} ans += b[i] ans b[i] b i a[i] -= b[i] a[i] a i b[i] b i b[i] = 0 b[i] b i 0 {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			} ans += a[i] ans a[i] a i b[i] -= a[i] b[i] b i a[i] a i a[i] = 0 a[i] a i 0 if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			} a[i + 1] > b[i] a[i + 1] a i + 1 i 1 b[i] b i {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} ans += b[i] ans b[i] b i a[i + 1] -= b[i] a[i + 1] a i + 1 i 1 b[i] b i b[i] = 0 b[i] b i 0 {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			} ans += a[i + 1] ans a[i + 1] a i + 1 i 1 b[i] -= a[i + 1] b[i] b i a[i + 1] a i + 1 i 1 a[i + 1] = 0 a[i + 1] a i + 1 i 1 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	} arrayInt {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	} int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			array[i] = sc.nextInt();
		} {
			array[i] = sc.nextInt();
		} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc return array; array Scanner sc sc int n n public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	} arrayLong {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	} long[] array = new long[n]; array new long[n] n for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			array[i] = sc.nextLong();
		} {
			array[i] = sc.nextLong();
		} array[i] = sc.nextLong() array[i] array i sc.nextLong() sc.nextLong sc return array; array Scanner sc sc int n n public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	} arrayDouble {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	} double[] array = new double[n]; array new double[n] n for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			array[i] = sc.nextDouble();
		} {
			array[i] = sc.nextDouble();
		} array[i] = sc.nextDouble() array[i] array i sc.nextDouble() sc.nextDouble sc return array; array Scanner sc sc int n n 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 + 1];
		for (int i = 0; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		b[n] = 0;
		sc.close();
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		}
		System.out.println(ans);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
} 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 + 1];
		for (int i = 0; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		b[n] = 0;
		sc.close();
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		}
		System.out.println(ans);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
} Main
import 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 + 1];
		for (int i = 0; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		b[n] = 0;
		sc.close();
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		}
		System.out.println(ans);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}
