import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int[] cities = new int[num+1];
		int[] savers = new int[num];
		for(int i = 0; i <= num; i++)cities[i] = sc.nextInt();
		for(int i = 0; i < num; i++)savers[i] = sc.nextInt();

		double ans = 0;
		for(int i = 0; i < num; i++){
			if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			}
			
			if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			}
		}


		System.out.printf("%.0f\n", ans);
	}
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int[] cities = new int[num+1];
		int[] savers = new int[num];
		for(int i = 0; i <= num; i++)cities[i] = sc.nextInt();
		for(int i = 0; i < num; i++)savers[i] = sc.nextInt();

		double ans = 0;
		for(int i = 0; i < num; i++){
			if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			}
			
			if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			}
		}


		System.out.printf("%.0f\n", ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int[] cities = new int[num+1];
		int[] savers = new int[num];
		for(int i = 0; i <= num; i++)cities[i] = sc.nextInt();
		for(int i = 0; i < num; i++)savers[i] = sc.nextInt();

		double ans = 0;
		for(int i = 0; i < num; i++){
			if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			}
			
			if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			}
		}


		System.out.printf("%.0f\n", ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int[] cities = new int[num+1];
		int[] savers = new int[num];
		for(int i = 0; i <= num; i++)cities[i] = sc.nextInt();
		for(int i = 0; i < num; i++)savers[i] = sc.nextInt();

		double ans = 0;
		for(int i = 0; i < num; i++){
			if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			}
			
			if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			}
		}


		System.out.printf("%.0f\n", ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int[] cities = new int[num+1]; cities new int[num+1] num+1 num 1 int[] savers = new int[num]; savers new int[num] num for(int i = 0; i <= num; i++)cities[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i <= num i num i++ i++ i cities[i] = sc.nextInt(); cities[i] = sc.nextInt() cities[i] cities i sc.nextInt() sc.nextInt sc for(int i = 0; i < num; i++)savers[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < num i num i++ i++ i savers[i] = sc.nextInt(); savers[i] = sc.nextInt() savers[i] savers i sc.nextInt() sc.nextInt sc double ans = 0; ans 0 for(int i = 0; i < num; i++){
			if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			}
			
			if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			}
		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
			if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			}
			
			if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			}
		} {
			if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			}
			
			if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			}
		} if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			} savers[i] <= cities[i] savers[i] savers i cities[i] cities i {
				ans += savers[i];
				savers[i] = 0;
				continue;
			} ans += savers[i] ans savers[i] savers i savers[i] = 0 savers[i] savers i 0 continue; {
				ans += cities[i];
				savers[i] -= cities[i];
			} ans += cities[i] ans cities[i] cities i savers[i] -= cities[i] savers[i] savers i cities[i] cities i if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			} savers[i] <= cities[i+1] savers[i] savers i cities[i+1] cities i+1 i 1 {
				ans += savers[i];
				cities[i+1] -= savers[i];
			} ans += savers[i] ans savers[i] savers i cities[i+1] -= savers[i] cities[i+1] cities i+1 i 1 savers[i] savers i {
				ans += cities[i+1];
				cities[i+1] = 0;
			} ans += cities[i+1] ans cities[i+1] cities i+1 i 1 cities[i+1] = 0 cities[i+1] cities i+1 i 1 0 System.out.printf("%.0f\n", ans) System.out.printf System.out System System.out "%.0f\n" ans String[] args args
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int[] cities = new int[num+1];
		int[] savers = new int[num];
		for(int i = 0; i <= num; i++)cities[i] = sc.nextInt();
		for(int i = 0; i < num; i++)savers[i] = sc.nextInt();

		double ans = 0;
		for(int i = 0; i < num; i++){
			if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			}
			
			if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			}
		}


		System.out.printf("%.0f\n", ans);
	}
}
