import java.io.*;
import java.math.BigInteger;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] monsters = new int[n+1];
		int i;
		for(i=0; i<=n; i++)
			monsters[i] = Integer.parseInt(line[i]);
		line = br.readLine().split(" ");
		int[] braves = new int[n];
		for(i=0; i<n; i++)
			braves[i] = Integer.parseInt(line[i]);
		
		BigInteger count = BigInteger.ZERO;
		int tmp, killed;
		for(i=0; i<n; i++){
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		}
		System.out.println(count);
	}
} import java.io.*; io.* java import java.math.BigInteger; BigInteger java.math public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] monsters = new int[n+1];
		int i;
		for(i=0; i<=n; i++)
			monsters[i] = Integer.parseInt(line[i]);
		line = br.readLine().split(" ");
		int[] braves = new int[n];
		for(i=0; i<n; i++)
			braves[i] = Integer.parseInt(line[i]);
		
		BigInteger count = BigInteger.ZERO;
		int tmp, killed;
		for(i=0; i<n; i++){
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] monsters = new int[n+1];
		int i;
		for(i=0; i<=n; i++)
			monsters[i] = Integer.parseInt(line[i]);
		line = br.readLine().split(" ");
		int[] braves = new int[n];
		for(i=0; i<n; i++)
			braves[i] = Integer.parseInt(line[i]);
		
		BigInteger count = BigInteger.ZERO;
		int tmp, killed;
		for(i=0; i<n; i++){
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		}
		System.out.println(count);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] monsters = new int[n+1];
		int i;
		for(i=0; i<=n; i++)
			monsters[i] = Integer.parseInt(line[i]);
		line = br.readLine().split(" ");
		int[] braves = new int[n];
		for(i=0; i<n; i++)
			braves[i] = Integer.parseInt(line[i]);
		
		BigInteger count = BigInteger.ZERO;
		int tmp, killed;
		for(i=0; i<n; i++){
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		}
		System.out.println(count);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] monsters = new int[n+1]; monsters new int[n+1] n+1 n 1 int i; i for(i=0; i<=n; i++)
			monsters[i] = Integer.parseInt(line[i]); i=0; i=0 i 0 i<=n i n i++ i++ i monsters[i] = Integer.parseInt(line[i]); monsters[i] = Integer.parseInt(line[i]) monsters[i] monsters i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i line = br.readLine().split(" ") line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] braves = new int[n]; braves new int[n] n for(i=0; i<n; i++)
			braves[i] = Integer.parseInt(line[i]); i=0; i=0 i 0 i<n i n i++ i++ i braves[i] = Integer.parseInt(line[i]); braves[i] = Integer.parseInt(line[i]) braves[i] braves i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i BigInteger count = BigInteger.ZERO; count BigInteger.ZERO BigInteger BigInteger.ZERO int tmp tmp killed; killed for(i=0; i<n; i++){
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		} i=0; i=0 i 0 i<n i n i++ i++ i {
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		} {
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		} tmp = braves[i] tmp braves[i] braves i killed = Math.min(tmp, monsters[i]) killed Math.min(tmp, monsters[i]) Math.min Math tmp monsters[i] monsters i monsters[i] -= killed monsters[i] monsters i killed tmp -= killed tmp killed count = count.add(new BigInteger(Integer.toString(killed))) count count.add(new BigInteger(Integer.toString(killed))) count.add count new BigInteger(Integer.toString(killed)) killed = Math.min(tmp, monsters[i+1]) killed Math.min(tmp, monsters[i+1]) Math.min Math tmp monsters[i+1] monsters i+1 i 1 tmp -= killed tmp killed monsters[i+1] -= killed monsters[i+1] monsters i+1 i 1 killed count = count.add(new BigInteger(Integer.toString(killed))) count count.add(new BigInteger(Integer.toString(killed))) count.add count new BigInteger(Integer.toString(killed)) System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] monsters = new int[n+1];
		int i;
		for(i=0; i<=n; i++)
			monsters[i] = Integer.parseInt(line[i]);
		line = br.readLine().split(" ");
		int[] braves = new int[n];
		for(i=0; i<n; i++)
			braves[i] = Integer.parseInt(line[i]);
		
		BigInteger count = BigInteger.ZERO;
		int tmp, killed;
		for(i=0; i<n; i++){
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		}
		System.out.println(count);
	}
} public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] monsters = new int[n+1];
		int i;
		for(i=0; i<=n; i++)
			monsters[i] = Integer.parseInt(line[i]);
		line = br.readLine().split(" ");
		int[] braves = new int[n];
		for(i=0; i<n; i++)
			braves[i] = Integer.parseInt(line[i]);
		
		BigInteger count = BigInteger.ZERO;
		int tmp, killed;
		for(i=0; i<n; i++){
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		}
		System.out.println(count);
	}
} Main
import java.io.*;
import java.math.BigInteger;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] monsters = new int[n+1];
		int i;
		for(i=0; i<=n; i++)
			monsters[i] = Integer.parseInt(line[i]);
		line = br.readLine().split(" ");
		int[] braves = new int[n];
		for(i=0; i<n; i++)
			braves[i] = Integer.parseInt(line[i]);
		
		BigInteger count = BigInteger.ZERO;
		int tmp, killed;
		for(i=0; i<n; i++){
			tmp = braves[i];
			killed = Math.min(tmp, monsters[i]);
			monsters[i] -= killed;
			tmp -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
			killed = Math.min(tmp, monsters[i+1]);
			tmp -= killed;
			monsters[i+1] -= killed;
			count = count.add(new BigInteger(Integer.toString(killed)));
		}
		System.out.println(count);
	}
}
