import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		List<Long> cityEnemy = new ArrayList<>();
		List<Long> hero = new ArrayList<>();

		for(int i = 0;i < n + 1;i++) {
			cityEnemy.add(sc.nextLong());
		}

		for(int i = 0;i < n;i++) {
			hero.add(sc.nextLong());
		}

		long killEnemyCnt = 0;
		for(int i = 0; i < n;i++) {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		}

		System.out.println(killEnemyCnt);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		List<Long> cityEnemy = new ArrayList<>();
		List<Long> hero = new ArrayList<>();

		for(int i = 0;i < n + 1;i++) {
			cityEnemy.add(sc.nextLong());
		}

		for(int i = 0;i < n;i++) {
			hero.add(sc.nextLong());
		}

		long killEnemyCnt = 0;
		for(int i = 0; i < n;i++) {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		}

		System.out.println(killEnemyCnt);
	}
} Main public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		List<Long> cityEnemy = new ArrayList<>();
		List<Long> hero = new ArrayList<>();

		for(int i = 0;i < n + 1;i++) {
			cityEnemy.add(sc.nextLong());
		}

		for(int i = 0;i < n;i++) {
			hero.add(sc.nextLong());
		}

		long killEnemyCnt = 0;
		for(int i = 0; i < n;i++) {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		}

		System.out.println(killEnemyCnt);
	} main {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		List<Long> cityEnemy = new ArrayList<>();
		List<Long> hero = new ArrayList<>();

		for(int i = 0;i < n + 1;i++) {
			cityEnemy.add(sc.nextLong());
		}

		for(int i = 0;i < n;i++) {
			hero.add(sc.nextLong());
		}

		long killEnemyCnt = 0;
		for(int i = 0; i < n;i++) {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		}

		System.out.println(killEnemyCnt);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc List<Long> cityEnemy = new ArrayList<>(); cityEnemy new ArrayList<>() List<Long> hero = new ArrayList<>(); hero new ArrayList<>() for(int i = 0;i < n + 1;i++) {
			cityEnemy.add(sc.nextLong());
		} int i = 0; int i = 0; i 0 i < n + 1 i n + 1 n 1 i++ i++ i {
			cityEnemy.add(sc.nextLong());
		} {
			cityEnemy.add(sc.nextLong());
		} cityEnemy.add(sc.nextLong()) cityEnemy.add cityEnemy sc.nextLong() sc.nextLong sc for(int i = 0;i < n;i++) {
			hero.add(sc.nextLong());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			hero.add(sc.nextLong());
		} {
			hero.add(sc.nextLong());
		} hero.add(sc.nextLong()) hero.add hero sc.nextLong() sc.nextLong sc long killEnemyCnt = 0; killEnemyCnt 0 for(int i = 0; i < n;i++) {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		} {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		} if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			} cityEnemy.get(i) < hero.get(i) cityEnemy.get(i) cityEnemy.get cityEnemy i hero.get(i) hero.get hero i {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			} killEnemyCnt += cityEnemy.get(i) killEnemyCnt cityEnemy.get(i) cityEnemy.get cityEnemy i hero.set(i, hero.get(i) - cityEnemy.get(i)) hero.set hero i hero.get(i) - cityEnemy.get(i) hero.get(i) hero.get hero i cityEnemy.get(i) cityEnemy.get cityEnemy i if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				} cityEnemy.get(i + 1) > hero.get(i) cityEnemy.get(i + 1) cityEnemy.get cityEnemy i + 1 i 1 hero.get(i) hero.get hero i {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				} killEnemyCnt += hero.get(i) killEnemyCnt hero.get(i) hero.get hero i cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i)) cityEnemy.set cityEnemy i + 1 i 1 cityEnemy.get(i + 1) - hero.get(i) cityEnemy.get(i + 1) cityEnemy.get cityEnemy i + 1 i 1 hero.get(i) hero.get hero i {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				} killEnemyCnt += cityEnemy.get(i + 1) killEnemyCnt cityEnemy.get(i + 1) cityEnemy.get cityEnemy i + 1 i 1 cityEnemy.set(i + 1, 0L) cityEnemy.set cityEnemy i + 1 i 1 0L {
				killEnemyCnt += hero.get(i);
			} killEnemyCnt += hero.get(i) killEnemyCnt hero.get(i) hero.get hero i System.out.println(killEnemyCnt) System.out.println System.out System System.out killEnemyCnt String args[] args public class Main {
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		List<Long> cityEnemy = new ArrayList<>();
		List<Long> hero = new ArrayList<>();

		for(int i = 0;i < n + 1;i++) {
			cityEnemy.add(sc.nextLong());
		}

		for(int i = 0;i < n;i++) {
			hero.add(sc.nextLong());
		}

		long killEnemyCnt = 0;
		for(int i = 0; i < n;i++) {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		}

		System.out.println(killEnemyCnt);
	}
} public class Main {
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		List<Long> cityEnemy = new ArrayList<>();
		List<Long> hero = new ArrayList<>();

		for(int i = 0;i < n + 1;i++) {
			cityEnemy.add(sc.nextLong());
		}

		for(int i = 0;i < n;i++) {
			hero.add(sc.nextLong());
		}

		long killEnemyCnt = 0;
		for(int i = 0; i < n;i++) {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		}

		System.out.println(killEnemyCnt);
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		List<Long> cityEnemy = new ArrayList<>();
		List<Long> hero = new ArrayList<>();

		for(int i = 0;i < n + 1;i++) {
			cityEnemy.add(sc.nextLong());
		}

		for(int i = 0;i < n;i++) {
			hero.add(sc.nextLong());
		}

		long killEnemyCnt = 0;
		for(int i = 0; i < n;i++) {
			if(cityEnemy.get(i) < hero.get(i)) {
				//i番目の街の処理
				killEnemyCnt += cityEnemy.get(i);
				hero.set(i, hero.get(i) - cityEnemy.get(i));

				if(cityEnemy.get(i + 1) > hero.get(i) ) {
					killEnemyCnt += hero.get(i);
					cityEnemy.set(i + 1, cityEnemy.get(i + 1) - hero.get(i));

				}else {
					killEnemyCnt += cityEnemy.get(i + 1);
					cityEnemy.set(i + 1, 0L);
				}

			}else {
				killEnemyCnt += hero.get(i);
			}
		}

		System.out.println(killEnemyCnt);
	}
}
