
import java.util.InputMismatchException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try {
			Scanner scanner = new Scanner(System.in);

			int n = scanner.nextInt();

			long[] a = new long[n+1];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}

			long[] b = new long[n];
			for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			}

			Main citySavers = new Main();
			System.out.println(citySavers.citySavers(a, b));

			scanner.close();

		} catch (InputMismatchException e) {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		}
	}


	public long citySavers(long[] a, long[] b) {
		long count = 0;

		for (int i = 0; i < b.length; i++) {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		}

		return count;
	}

}
 import java.util.InputMismatchException; InputMismatchException java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		try {
			Scanner scanner = new Scanner(System.in);

			int n = scanner.nextInt();

			long[] a = new long[n+1];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}

			long[] b = new long[n];
			for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			}

			Main citySavers = new Main();
			System.out.println(citySavers.citySavers(a, b));

			scanner.close();

		} catch (InputMismatchException e) {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		}
	}


	public long citySavers(long[] a, long[] b) {
		long count = 0;

		for (int i = 0; i < b.length; i++) {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		}

		return count;
	}

} Main public static void main(String[] args) {
		try {
			Scanner scanner = new Scanner(System.in);

			int n = scanner.nextInt();

			long[] a = new long[n+1];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}

			long[] b = new long[n];
			for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			}

			Main citySavers = new Main();
			System.out.println(citySavers.citySavers(a, b));

			scanner.close();

		} catch (InputMismatchException e) {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		}
	} main {
		try {
			Scanner scanner = new Scanner(System.in);

			int n = scanner.nextInt();

			long[] a = new long[n+1];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}

			long[] b = new long[n];
			for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			}

			Main citySavers = new Main();
			System.out.println(citySavers.citySavers(a, b));

			scanner.close();

		} catch (InputMismatchException e) {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		}
	} try {
			Scanner scanner = new Scanner(System.in);

			int n = scanner.nextInt();

			long[] a = new long[n+1];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}

			long[] b = new long[n];
			for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			}

			Main citySavers = new Main();
			System.out.println(citySavers.citySavers(a, b));

			scanner.close();

		} catch (InputMismatchException e) {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		} catch (InputMismatchException e) {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		} InputMismatchException e {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		} System.out.println("整数を入力してください") System.out.println System.out System System.out "整数を入力してください" {
			Scanner scanner = new Scanner(System.in);

			int n = scanner.nextInt();

			long[] a = new long[n+1];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}

			long[] b = new long[n];
			for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			}

			Main citySavers = new Main();
			System.out.println(citySavers.citySavers(a, b));

			scanner.close();

		} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner long[] a = new long[n+1]; a new long[n+1] n+1 n 1 for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
				a[i] = scanner.nextInt();
			} {
				a[i] = scanner.nextInt();
			} a[i] = scanner.nextInt() a[i] a i scanner.nextInt() scanner.nextInt scanner long[] b = new long[n]; b new long[n] n for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			} int i = 0; int i = 0; i 0 i < b.length i b.length b b.length i++ i++ i {
				b[i] = scanner.nextInt();
			} {
				b[i] = scanner.nextInt();
			} b[i] = scanner.nextInt() b[i] b i scanner.nextInt() scanner.nextInt scanner Main citySavers = new Main(); citySavers new Main() System.out.println(citySavers.citySavers(a, b)) System.out.println System.out System System.out citySavers.citySavers(a, b) citySavers.citySavers citySavers a b scanner.close() scanner.close scanner String[] args args public long citySavers(long[] a, long[] b) {
		long count = 0;

		for (int i = 0; i < b.length; i++) {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		}

		return count;
	} citySavers {
		long count = 0;

		for (int i = 0; i < b.length; i++) {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		}

		return count;
	} long count = 0; count 0 for (int i = 0; i < b.length; i++) {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		} int i = 0; int i = 0; i 0 i < b.length i b.length b b.length i++ i++ i {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		} {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		} if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			} a[i] >= b[i] a[i] a i b[i] b i {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			} count = count + b[i] count count + b[i] count b[i] b i if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			} a[i+1] >= b[i] - a[i] a[i+1] a i+1 i 1 b[i] - a[i] b[i] b i a[i] a i {	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			} count = count + b[i] count count + b[i] count b[i] b i a[i+1] = a[i+1] + a[i] - b[i] a[i+1] a i+1 i 1 a[i+1] + a[i] - b[i] a[i+1] + a[i] a[i+1] a i+1 i 1 a[i] a i b[i] b i {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			} count = count + a[i] + a[i+1] count count + a[i] + a[i+1] count + a[i] + a[i+1] count a[i] a i a[i+1] a i+1 i 1 a[i+1] = 0 a[i+1] a i+1 i 1 0 return count; count long[] a a long[] b b public class Main {
	public static void main(String[] args) {
		try {
			Scanner scanner = new Scanner(System.in);

			int n = scanner.nextInt();

			long[] a = new long[n+1];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}

			long[] b = new long[n];
			for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			}

			Main citySavers = new Main();
			System.out.println(citySavers.citySavers(a, b));

			scanner.close();

		} catch (InputMismatchException e) {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		}
	}


	public long citySavers(long[] a, long[] b) {
		long count = 0;

		for (int i = 0; i < b.length; i++) {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		}

		return count;
	}

} public class Main {
	public static void main(String[] args) {
		try {
			Scanner scanner = new Scanner(System.in);

			int n = scanner.nextInt();

			long[] a = new long[n+1];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}

			long[] b = new long[n];
			for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			}

			Main citySavers = new Main();
			System.out.println(citySavers.citySavers(a, b));

			scanner.close();

		} catch (InputMismatchException e) {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		}
	}


	public long citySavers(long[] a, long[] b) {
		long count = 0;

		for (int i = 0; i < b.length; i++) {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		}

		return count;
	}

} Main

import java.util.InputMismatchException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try {
			Scanner scanner = new Scanner(System.in);

			int n = scanner.nextInt();

			long[] a = new long[n+1];
			for (int i = 0; i < a.length; i++) {
				a[i] = scanner.nextInt();
			}

			long[] b = new long[n];
			for (int i = 0; i < b.length; i++) {
				b[i] = scanner.nextInt();
			}

			Main citySavers = new Main();
			System.out.println(citySavers.citySavers(a, b));

			scanner.close();

		} catch (InputMismatchException e) {
			// TODO: handle exception
			System.out.println("整数を入力してください");
		}
	}


	public long citySavers(long[] a, long[] b) {
		long count = 0;

		for (int i = 0; i < b.length; i++) {
			if (a[i] >= b[i]) {					//1つ目の街の敵>倒せる数
				count = count + b[i];
			}else if (a[i+1] >= b[i] - a[i]){	//1つ目の街の敵+2つ目の街の敵>倒せる数
				count = count + b[i];
				a[i+1] = a[i+1] + a[i] - b[i];
			}else {								//1つ目の街の敵+2つ目の街の敵<倒せる数
				count = count + a[i] + a[i+1];
				a[i+1] = 0;
			}
		}

		return count;
	}

}

