import java.util.*;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {	
		 Scanner scanner = new Scanner(System.in);
		   long N = scanner.nextLong();
		   Map<Long,Long> map_A = new HashMap<>();
      	   Map<Long,Long> map_B = new HashMap<>();

      		for(long i = 1; i < N+2; i++){
              long A = scanner.nextLong();
              map_A.put(i,A);
            }
      		for(long i = 1; i < N+1; i++){
              long B = scanner.nextLong();
              map_B.put(i,B);
            }

      		long ans = 0;
      		for(long i = 1; i < N+1; i++){
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            }
      System.out.println(ans);
	}

} import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {	
		 Scanner scanner = new Scanner(System.in);
		   long N = scanner.nextLong();
		   Map<Long,Long> map_A = new HashMap<>();
      	   Map<Long,Long> map_B = new HashMap<>();

      		for(long i = 1; i < N+2; i++){
              long A = scanner.nextLong();
              map_A.put(i,A);
            }
      		for(long i = 1; i < N+1; i++){
              long B = scanner.nextLong();
              map_B.put(i,B);
            }

      		long ans = 0;
      		for(long i = 1; i < N+1; i++){
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            }
      System.out.println(ans);
	}

} Main public static void main(String[] args) {	
		 Scanner scanner = new Scanner(System.in);
		   long N = scanner.nextLong();
		   Map<Long,Long> map_A = new HashMap<>();
      	   Map<Long,Long> map_B = new HashMap<>();

      		for(long i = 1; i < N+2; i++){
              long A = scanner.nextLong();
              map_A.put(i,A);
            }
      		for(long i = 1; i < N+1; i++){
              long B = scanner.nextLong();
              map_B.put(i,B);
            }

      		long ans = 0;
      		for(long i = 1; i < N+1; i++){
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            }
      System.out.println(ans);
	} main {	
		 Scanner scanner = new Scanner(System.in);
		   long N = scanner.nextLong();
		   Map<Long,Long> map_A = new HashMap<>();
      	   Map<Long,Long> map_B = new HashMap<>();

      		for(long i = 1; i < N+2; i++){
              long A = scanner.nextLong();
              map_A.put(i,A);
            }
      		for(long i = 1; i < N+1; i++){
              long B = scanner.nextLong();
              map_B.put(i,B);
            }

      		long ans = 0;
      		for(long i = 1; i < N+1; i++){
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            }
      System.out.println(ans);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) long N = scanner.nextLong(); N scanner.nextLong() scanner.nextLong scanner Map<Long,Long> map_A = new HashMap<>(); map_A new HashMap<>() Map<Long,Long> map_B = new HashMap<>(); map_B new HashMap<>() for(long i = 1; i < N+2; i++){
              long A = scanner.nextLong();
              map_A.put(i,A);
            } long i = 1; long i = 1; i 1 i < N+2 i N+2 N 2 i++ i++ i {
              long A = scanner.nextLong();
              map_A.put(i,A);
            } {
              long A = scanner.nextLong();
              map_A.put(i,A);
            } long A = scanner.nextLong(); A scanner.nextLong() scanner.nextLong scanner map_A.put(i,A) map_A.put map_A i A for(long i = 1; i < N+1; i++){
              long B = scanner.nextLong();
              map_B.put(i,B);
            } long i = 1; long i = 1; i 1 i < N+1 i N+1 N 1 i++ i++ i {
              long B = scanner.nextLong();
              map_B.put(i,B);
            } {
              long B = scanner.nextLong();
              map_B.put(i,B);
            } long B = scanner.nextLong(); B scanner.nextLong() scanner.nextLong scanner map_B.put(i,B) map_B.put map_B i B long ans = 0; ans 0 for(long i = 1; i < N+1; i++){
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            } long i = 1; long i = 1; i 1 i < N+1 i N+1 N 1 i++ i++ i {
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            } {
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            } ans += Math.min(map_A.get(i), map_B.get(i)) ans Math.min(map_A.get(i), map_B.get(i)) Math.min Math map_A.get(i) map_A.get map_A i map_B.get(i) map_B.get map_B i long j = Math.max(0, map_B.get(i) -map_A.get(i)); j Math.max(0, map_B.get(i) -map_A.get(i)) Math.max Math 0 map_B.get(i) -map_A.get(i) map_B.get(i) map_B.get map_B i map_A.get(i) map_A.get map_A i ans += Math.min(map_A.get(i+1), j) ans Math.min(map_A.get(i+1), j) Math.min Math map_A.get(i+1) map_A.get map_A i+1 i 1 j map_A.put(i+1,Math.max(0, map_A.get(i+1) - j)) map_A.put map_A i+1 i 1 Math.max(0, map_A.get(i+1) - j) Math.max Math 0 map_A.get(i+1) - j map_A.get(i+1) map_A.get map_A i+1 i 1 j System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {	
		 Scanner scanner = new Scanner(System.in);
		   long N = scanner.nextLong();
		   Map<Long,Long> map_A = new HashMap<>();
      	   Map<Long,Long> map_B = new HashMap<>();

      		for(long i = 1; i < N+2; i++){
              long A = scanner.nextLong();
              map_A.put(i,A);
            }
      		for(long i = 1; i < N+1; i++){
              long B = scanner.nextLong();
              map_B.put(i,B);
            }

      		long ans = 0;
      		for(long i = 1; i < N+1; i++){
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            }
      System.out.println(ans);
	}

} public class Main {
	public static void main(String[] args) {	
		 Scanner scanner = new Scanner(System.in);
		   long N = scanner.nextLong();
		   Map<Long,Long> map_A = new HashMap<>();
      	   Map<Long,Long> map_B = new HashMap<>();

      		for(long i = 1; i < N+2; i++){
              long A = scanner.nextLong();
              map_A.put(i,A);
            }
      		for(long i = 1; i < N+1; i++){
              long B = scanner.nextLong();
              map_B.put(i,B);
            }

      		long ans = 0;
      		for(long i = 1; i < N+1; i++){
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            }
      System.out.println(ans);
	}

} Main
import java.util.*;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {	
		 Scanner scanner = new Scanner(System.in);
		   long N = scanner.nextLong();
		   Map<Long,Long> map_A = new HashMap<>();
      	   Map<Long,Long> map_B = new HashMap<>();

      		for(long i = 1; i < N+2; i++){
              long A = scanner.nextLong();
              map_A.put(i,A);
            }
      		for(long i = 1; i < N+1; i++){
              long B = scanner.nextLong();
              map_B.put(i,B);
            }

      		long ans = 0;
      		for(long i = 1; i < N+1; i++){
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            }
      System.out.println(ans);
	}

}
