import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}
	
	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] monsterArr = new int[n+1];
		int[] heroArr = new int[n];
		
		for(int i = 0; i < n+1;i++) {
			monsterArr[i] = sc.nextInt();
		}
		for(int i = 0; i < n;i++) {
			heroArr[i] = sc.nextInt();
		}
		
		sc.close();
		
		long ans = 0;
		for(int i = 0; i < n; i++) {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		}
		
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}
	
	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] monsterArr = new int[n+1];
		int[] heroArr = new int[n];
		
		for(int i = 0; i < n+1;i++) {
			monsterArr[i] = sc.nextInt();
		}
		for(int i = 0; i < n;i++) {
			heroArr[i] = sc.nextInt();
		}
		
		sc.close();
		
		long ans = 0;
		for(int i = 0; i < n; i++) {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		}
		
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	} main {
		Main mainObj = new Main();
		mainObj.solve();
	} Main mainObj = new Main(); mainObj new Main() mainObj.solve() mainObj.solve mainObj String[] args args void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] monsterArr = new int[n+1];
		int[] heroArr = new int[n];
		
		for(int i = 0; i < n+1;i++) {
			monsterArr[i] = sc.nextInt();
		}
		for(int i = 0; i < n;i++) {
			heroArr[i] = sc.nextInt();
		}
		
		sc.close();
		
		long ans = 0;
		for(int i = 0; i < n; i++) {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		}
		
		System.out.println(ans);
	} solve {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] monsterArr = new int[n+1];
		int[] heroArr = new int[n];
		
		for(int i = 0; i < n+1;i++) {
			monsterArr[i] = sc.nextInt();
		}
		for(int i = 0; i < n;i++) {
			heroArr[i] = sc.nextInt();
		}
		
		sc.close();
		
		long ans = 0;
		for(int i = 0; i < n; i++) {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[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[] monsterArr = new int[n+1]; monsterArr new int[n+1] n+1 n 1 int[] heroArr = new int[n]; heroArr new int[n] n for(int i = 0; i < n+1;i++) {
			monsterArr[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n+1 i n+1 n 1 i++ i++ i {
			monsterArr[i] = sc.nextInt();
		} {
			monsterArr[i] = sc.nextInt();
		} monsterArr[i] = sc.nextInt() monsterArr[i] monsterArr i sc.nextInt() sc.nextInt sc for(int i = 0; i < n;i++) {
			heroArr[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			heroArr[i] = sc.nextInt();
		} {
			heroArr[i] = sc.nextInt();
		} heroArr[i] = sc.nextInt() heroArr[i] heroArr i sc.nextInt() sc.nextInt sc sc.close() sc.close sc long ans = 0; ans 0 for(int i = 0; i < n; i++) {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		} {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		} int numOfMonster = monsterArr[i]; numOfMonster monsterArr[i] monsterArr i int capableBeat = heroArr[i]; capableBeat heroArr[i] heroArr i if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			} numOfMonster >= capableBeat numOfMonster capableBeat {
				ans += capableBeat;
			} ans += capableBeat ans capableBeat {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			} capableBeat -= numOfMonster capableBeat numOfMonster ans += numOfMonster ans numOfMonster int nextMonster = monsterArr[i+1]; nextMonster monsterArr[i+1] monsterArr i+1 i 1 if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				} nextMonster >= capableBeat nextMonster capableBeat {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				} ans += capableBeat ans capableBeat monsterArr[i + 1] -= capableBeat monsterArr[i + 1] monsterArr i + 1 i 1 capableBeat {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				} ans += nextMonster ans nextMonster monsterArr[i + 1] = 0 monsterArr[i + 1] monsterArr i + 1 i 1 0 System.out.println(ans) System.out.println System.out System System.out ans public class Main {

	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}
	
	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] monsterArr = new int[n+1];
		int[] heroArr = new int[n];
		
		for(int i = 0; i < n+1;i++) {
			monsterArr[i] = sc.nextInt();
		}
		for(int i = 0; i < n;i++) {
			heroArr[i] = sc.nextInt();
		}
		
		sc.close();
		
		long ans = 0;
		for(int i = 0; i < n; i++) {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		}
		
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}
	
	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] monsterArr = new int[n+1];
		int[] heroArr = new int[n];
		
		for(int i = 0; i < n+1;i++) {
			monsterArr[i] = sc.nextInt();
		}
		for(int i = 0; i < n;i++) {
			heroArr[i] = sc.nextInt();
		}
		
		sc.close();
		
		long ans = 0;
		for(int i = 0; i < n; i++) {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		}
		
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}
	
	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] monsterArr = new int[n+1];
		int[] heroArr = new int[n];
		
		for(int i = 0; i < n+1;i++) {
			monsterArr[i] = sc.nextInt();
		}
		for(int i = 0; i < n;i++) {
			heroArr[i] = sc.nextInt();
		}
		
		sc.close();
		
		long ans = 0;
		for(int i = 0; i < n; i++) {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		}
		
		System.out.println(ans);
	}
}
