import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int MAX = 1000000002;
		ArrayList<Integer> monster = new ArrayList<Integer>();
		ArrayList<Integer> heroes = new ArrayList<Integer>();
		int n;
		long maximo = 0;
		n = reader.nextInt();
		for(int i=0; i<n+1; i++)
			monster.add(reader.nextInt());
		for(int i=0; i<n; i++)
			heroes.add(reader.nextInt());
		
		for(int i=0; i<n;i++) {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		}
		System.out.println(maximo);
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int MAX = 1000000002;
		ArrayList<Integer> monster = new ArrayList<Integer>();
		ArrayList<Integer> heroes = new ArrayList<Integer>();
		int n;
		long maximo = 0;
		n = reader.nextInt();
		for(int i=0; i<n+1; i++)
			monster.add(reader.nextInt());
		for(int i=0; i<n; i++)
			heroes.add(reader.nextInt());
		
		for(int i=0; i<n;i++) {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		}
		System.out.println(maximo);
	}

} Main public static void main(String[] args) {
		Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int MAX = 1000000002;
		ArrayList<Integer> monster = new ArrayList<Integer>();
		ArrayList<Integer> heroes = new ArrayList<Integer>();
		int n;
		long maximo = 0;
		n = reader.nextInt();
		for(int i=0; i<n+1; i++)
			monster.add(reader.nextInt());
		for(int i=0; i<n; i++)
			heroes.add(reader.nextInt());
		
		for(int i=0; i<n;i++) {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		}
		System.out.println(maximo);
	} main {
		Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int MAX = 1000000002;
		ArrayList<Integer> monster = new ArrayList<Integer>();
		ArrayList<Integer> heroes = new ArrayList<Integer>();
		int n;
		long maximo = 0;
		n = reader.nextInt();
		for(int i=0; i<n+1; i++)
			monster.add(reader.nextInt());
		for(int i=0; i<n; i++)
			heroes.add(reader.nextInt());
		
		for(int i=0; i<n;i++) {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		}
		System.out.println(maximo);
	} Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in))); reader new Scanner(new BufferedReader(new InputStreamReader(System.in))) int MAX = 1000000002; MAX 1000000002 ArrayList<Integer> monster = new ArrayList<Integer>(); monster new ArrayList<Integer>() ArrayList<Integer> heroes = new ArrayList<Integer>(); heroes new ArrayList<Integer>() int n; n long maximo = 0; maximo 0 n = reader.nextInt() n reader.nextInt() reader.nextInt reader for(int i=0; i<n+1; i++)
			monster.add(reader.nextInt()); int i=0; int i=0; i 0 i<n+1 i n+1 n 1 i++ i++ i monster.add(reader.nextInt()); monster.add(reader.nextInt()) monster.add monster reader.nextInt() reader.nextInt reader for(int i=0; i<n; i++)
			heroes.add(reader.nextInt()); int i=0; int i=0; i 0 i<n i n i++ i++ i heroes.add(reader.nextInt()); heroes.add(reader.nextInt()) heroes.add heroes reader.nextInt() reader.nextInt reader for(int i=0; i<n;i++) {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		} {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		} if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			} heroes.get(i) <= monster.get(i) heroes.get(i) heroes.get heroes i monster.get(i) monster.get monster i {
				maximo += heroes.get(i);
			} maximo += heroes.get(i) maximo heroes.get(i) heroes.get heroes i {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			} heroes.set(i, heroes.get(i) - monster.get(i)) heroes.set heroes i heroes.get(i) - monster.get(i) heroes.get(i) heroes.get heroes i monster.get(i) monster.get monster i maximo+=monster.get(i) maximo monster.get(i) monster.get monster i if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				} heroes.get(i)>=monster.get(i+1) heroes.get(i) heroes.get heroes i monster.get(i+1) monster.get monster i+1 i 1 {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				} maximo+=monster.get(i+1) maximo monster.get(i+1) monster.get monster i+1 i 1 monster.set(i+1, 0) monster.set monster i+1 i 1 0 {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				} maximo+=heroes.get(i) maximo heroes.get(i) heroes.get heroes i monster.set(i+1, monster.get(i+1)-heroes.get(i)) monster.set monster i+1 i 1 monster.get(i+1)-heroes.get(i) monster.get(i+1) monster.get monster i+1 i 1 heroes.get(i) heroes.get heroes i System.out.println(maximo) System.out.println System.out System System.out maximo String[] args args public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int MAX = 1000000002;
		ArrayList<Integer> monster = new ArrayList<Integer>();
		ArrayList<Integer> heroes = new ArrayList<Integer>();
		int n;
		long maximo = 0;
		n = reader.nextInt();
		for(int i=0; i<n+1; i++)
			monster.add(reader.nextInt());
		for(int i=0; i<n; i++)
			heroes.add(reader.nextInt());
		
		for(int i=0; i<n;i++) {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		}
		System.out.println(maximo);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int MAX = 1000000002;
		ArrayList<Integer> monster = new ArrayList<Integer>();
		ArrayList<Integer> heroes = new ArrayList<Integer>();
		int n;
		long maximo = 0;
		n = reader.nextInt();
		for(int i=0; i<n+1; i++)
			monster.add(reader.nextInt());
		for(int i=0; i<n; i++)
			heroes.add(reader.nextInt());
		
		for(int i=0; i<n;i++) {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		}
		System.out.println(maximo);
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int MAX = 1000000002;
		ArrayList<Integer> monster = new ArrayList<Integer>();
		ArrayList<Integer> heroes = new ArrayList<Integer>();
		int n;
		long maximo = 0;
		n = reader.nextInt();
		for(int i=0; i<n+1; i++)
			monster.add(reader.nextInt());
		for(int i=0; i<n; i++)
			heroes.add(reader.nextInt());
		
		for(int i=0; i<n;i++) {
			if(heroes.get(i) <= monster.get(i)) {
				maximo += heroes.get(i);
			}else {
				//heroes[i]-=monster[i];
				
				heroes.set(i, heroes.get(i) - monster.get(i));
				maximo+=monster.get(i);
				if(heroes.get(i)>=monster.get(i+1)) {
					maximo+=monster.get(i+1);
					monster.set(i+1, 0);
				}else {
					maximo+=heroes.get(i);
					monster.set(i+1, monster.get(i+1)-heroes.get(i));
					//monster[i+1]-=heroes[i];
				}
			}
		}
		System.out.println(maximo);
	}

}
