import java.util.Scanner;

public class Main {
	static long count;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] monster = new long[n+1];
		long[] saver = new long[n];

		for (int i = 0; i < n+1; i++) {
			monster[i] = sc.nextLong();
		}

		for (int i = 0; i < n; i++) {
			saver[i] = sc.nextLong();
		}

		long leftOver = monster[0];
		for (int i = 0; i < n; i++) {
			leftOver = attack(leftOver, i, saver, monster);
		}

		System.out.println(count);

	}

	private static long attack(long leftOver, int town, long[] saver, long[] monster) {
		long killFirst = Math.min(leftOver, saver[town]);
		long killSecondPoten = saver[town] - killFirst > 0 ? saver[town] - killFirst : 0;
		long killSecond = Math.min(killSecondPoten, monster[town+1]);
		long secondLeft = monster[town+1] - killSecondPoten > 0 ? monster[town+1] - killSecondPoten : 0;
		count += (killFirst + killSecond);
		return secondLeft;
	}

} import java.util.Scanner; Scanner java.util public class Main {
	static long count;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] monster = new long[n+1];
		long[] saver = new long[n];

		for (int i = 0; i < n+1; i++) {
			monster[i] = sc.nextLong();
		}

		for (int i = 0; i < n; i++) {
			saver[i] = sc.nextLong();
		}

		long leftOver = monster[0];
		for (int i = 0; i < n; i++) {
			leftOver = attack(leftOver, i, saver, monster);
		}

		System.out.println(count);

	}

	private static long attack(long leftOver, int town, long[] saver, long[] monster) {
		long killFirst = Math.min(leftOver, saver[town]);
		long killSecondPoten = saver[town] - killFirst > 0 ? saver[town] - killFirst : 0;
		long killSecond = Math.min(killSecondPoten, monster[town+1]);
		long secondLeft = monster[town+1] - killSecondPoten > 0 ? monster[town+1] - killSecondPoten : 0;
		count += (killFirst + killSecond);
		return secondLeft;
	}

} Main static long count; count public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] monster = new long[n+1];
		long[] saver = new long[n];

		for (int i = 0; i < n+1; i++) {
			monster[i] = sc.nextLong();
		}

		for (int i = 0; i < n; i++) {
			saver[i] = sc.nextLong();
		}

		long leftOver = monster[0];
		for (int i = 0; i < n; i++) {
			leftOver = attack(leftOver, i, saver, monster);
		}

		System.out.println(count);

	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] monster = new long[n+1];
		long[] saver = new long[n];

		for (int i = 0; i < n+1; i++) {
			monster[i] = sc.nextLong();
		}

		for (int i = 0; i < n; i++) {
			saver[i] = sc.nextLong();
		}

		long leftOver = monster[0];
		for (int i = 0; i < n; i++) {
			leftOver = attack(leftOver, i, saver, monster);
		}

		System.out.println(count);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long[] monster = new long[n+1]; monster new long[n+1] n+1 n 1 long[] saver = new long[n]; saver new long[n] n for (int i = 0; i < n+1; i++) {
			monster[i] = sc.nextLong();
		} int i = 0; int i = 0; i 0 i < n+1 i n+1 n 1 i++ i++ i {
			monster[i] = sc.nextLong();
		} {
			monster[i] = sc.nextLong();
		} monster[i] = sc.nextLong() monster[i] monster i sc.nextLong() sc.nextLong sc for (int i = 0; i < n; i++) {
			saver[i] = sc.nextLong();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			saver[i] = sc.nextLong();
		} {
			saver[i] = sc.nextLong();
		} saver[i] = sc.nextLong() saver[i] saver i sc.nextLong() sc.nextLong sc long leftOver = monster[0]; leftOver monster[0] monster 0 for (int i = 0; i < n; i++) {
			leftOver = attack(leftOver, i, saver, monster);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			leftOver = attack(leftOver, i, saver, monster);
		} {
			leftOver = attack(leftOver, i, saver, monster);
		} leftOver = attack(leftOver, i, saver, monster) leftOver attack(leftOver, i, saver, monster) attack leftOver i saver monster System.out.println(count) System.out.println System.out System System.out count String[] args args private static long attack(long leftOver, int town, long[] saver, long[] monster) {
		long killFirst = Math.min(leftOver, saver[town]);
		long killSecondPoten = saver[town] - killFirst > 0 ? saver[town] - killFirst : 0;
		long killSecond = Math.min(killSecondPoten, monster[town+1]);
		long secondLeft = monster[town+1] - killSecondPoten > 0 ? monster[town+1] - killSecondPoten : 0;
		count += (killFirst + killSecond);
		return secondLeft;
	} attack {
		long killFirst = Math.min(leftOver, saver[town]);
		long killSecondPoten = saver[town] - killFirst > 0 ? saver[town] - killFirst : 0;
		long killSecond = Math.min(killSecondPoten, monster[town+1]);
		long secondLeft = monster[town+1] - killSecondPoten > 0 ? monster[town+1] - killSecondPoten : 0;
		count += (killFirst + killSecond);
		return secondLeft;
	} long killFirst = Math.min(leftOver, saver[town]); killFirst Math.min(leftOver, saver[town]) Math.min Math leftOver saver[town] saver town long killSecondPoten = saver[town] - killFirst > 0 ? saver[town] - killFirst : 0; killSecondPoten saver[town] - killFirst > 0 ? saver[town] - killFirst : 0 saver[town] - killFirst > 0 saver[town] - killFirst saver[town] saver town killFirst 0 saver[town] - killFirst saver[town] saver town killFirst 0 long killSecond = Math.min(killSecondPoten, monster[town+1]); killSecond Math.min(killSecondPoten, monster[town+1]) Math.min Math killSecondPoten monster[town+1] monster town+1 town 1 long secondLeft = monster[town+1] - killSecondPoten > 0 ? monster[town+1] - killSecondPoten : 0; secondLeft monster[town+1] - killSecondPoten > 0 ? monster[town+1] - killSecondPoten : 0 monster[town+1] - killSecondPoten > 0 monster[town+1] - killSecondPoten monster[town+1] monster town+1 town 1 killSecondPoten 0 monster[town+1] - killSecondPoten monster[town+1] monster town+1 town 1 killSecondPoten 0 count += (killFirst + killSecond) count (killFirst + killSecond) killFirst killSecond return secondLeft; secondLeft long leftOver leftOver int town town long[] saver saver long[] monster monster public class Main {
	static long count;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] monster = new long[n+1];
		long[] saver = new long[n];

		for (int i = 0; i < n+1; i++) {
			monster[i] = sc.nextLong();
		}

		for (int i = 0; i < n; i++) {
			saver[i] = sc.nextLong();
		}

		long leftOver = monster[0];
		for (int i = 0; i < n; i++) {
			leftOver = attack(leftOver, i, saver, monster);
		}

		System.out.println(count);

	}

	private static long attack(long leftOver, int town, long[] saver, long[] monster) {
		long killFirst = Math.min(leftOver, saver[town]);
		long killSecondPoten = saver[town] - killFirst > 0 ? saver[town] - killFirst : 0;
		long killSecond = Math.min(killSecondPoten, monster[town+1]);
		long secondLeft = monster[town+1] - killSecondPoten > 0 ? monster[town+1] - killSecondPoten : 0;
		count += (killFirst + killSecond);
		return secondLeft;
	}

} public class Main {
	static long count;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] monster = new long[n+1];
		long[] saver = new long[n];

		for (int i = 0; i < n+1; i++) {
			monster[i] = sc.nextLong();
		}

		for (int i = 0; i < n; i++) {
			saver[i] = sc.nextLong();
		}

		long leftOver = monster[0];
		for (int i = 0; i < n; i++) {
			leftOver = attack(leftOver, i, saver, monster);
		}

		System.out.println(count);

	}

	private static long attack(long leftOver, int town, long[] saver, long[] monster) {
		long killFirst = Math.min(leftOver, saver[town]);
		long killSecondPoten = saver[town] - killFirst > 0 ? saver[town] - killFirst : 0;
		long killSecond = Math.min(killSecondPoten, monster[town+1]);
		long secondLeft = monster[town+1] - killSecondPoten > 0 ? monster[town+1] - killSecondPoten : 0;
		count += (killFirst + killSecond);
		return secondLeft;
	}

} Main
import java.util.Scanner;

public class Main {
	static long count;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] monster = new long[n+1];
		long[] saver = new long[n];

		for (int i = 0; i < n+1; i++) {
			monster[i] = sc.nextLong();
		}

		for (int i = 0; i < n; i++) {
			saver[i] = sc.nextLong();
		}

		long leftOver = monster[0];
		for (int i = 0; i < n; i++) {
			leftOver = attack(leftOver, i, saver, monster);
		}

		System.out.println(count);

	}

	private static long attack(long leftOver, int town, long[] saver, long[] monster) {
		long killFirst = Math.min(leftOver, saver[town]);
		long killSecondPoten = saver[town] - killFirst > 0 ? saver[town] - killFirst : 0;
		long killSecond = Math.min(killSecondPoten, monster[town+1]);
		long secondLeft = monster[town+1] - killSecondPoten > 0 ? monster[town+1] - killSecondPoten : 0;
		count += (killFirst + killSecond);
		return secondLeft;
	}

}