import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] p = new long[2*N+1];
        long D = 0;
        
        for(int i = 0; i < 2*N+1; i++){
            p[i] = sc.nextLong();
        }
        
        for(int i = 0; i < N; i++){
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        }
        
        System.out.println(D);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] p = new long[2*N+1];
        long D = 0;
        
        for(int i = 0; i < 2*N+1; i++){
            p[i] = sc.nextLong();
        }
        
        for(int i = 0; i < N; i++){
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        }
        
        System.out.println(D);
    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] p = new long[2*N+1];
        long D = 0;
        
        for(int i = 0; i < 2*N+1; i++){
            p[i] = sc.nextLong();
        }
        
        for(int i = 0; i < N; i++){
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        }
        
        System.out.println(D);
    } main {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] p = new long[2*N+1];
        long D = 0;
        
        for(int i = 0; i < 2*N+1; i++){
            p[i] = sc.nextLong();
        }
        
        for(int i = 0; i < N; i++){
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        }
        
        System.out.println(D);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc long[] p = new long[2*N+1]; p new long[2*N+1] 2*N+1 2*N 2 N 1 long D = 0; D 0 for(int i = 0; i < 2*N+1; i++){
            p[i] = sc.nextLong();
        } int i = 0; int i = 0; i 0 i < 2*N+1 i 2*N+1 2*N 2 N 1 i++ i++ i {
            p[i] = sc.nextLong();
        } {
            p[i] = sc.nextLong();
        } p[i] = sc.nextLong() p[i] p i sc.nextLong() sc.nextLong sc for(int i = 0; i < N; i++){
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        } {
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        } if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            } p[i] - p[N+1+i] >= 0 p[i] - p[N+1+i] p[i] p i p[N+1+i] p N+1+i N+1+i N 1 i 0 {
                D = D + p[N+1+i];
            } D = D + p[N+1+i] D D + p[N+1+i] D p[N+1+i] p N+1+i N+1+i N 1 i {
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            } if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                } p[i+1] - (p[N+1+i] - p[i]) >= 0 p[i+1] - (p[N+1+i] - p[i]) p[i+1] p i+1 i 1 (p[N+1+i] - p[i]) p[N+1+i] p N+1+i N+1+i N 1 i p[i] p i 0 {
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                } D = D + p[N+1+i] D D + p[N+1+i] D p[N+1+i] p N+1+i N+1+i N 1 i p[i+1] = p[i+1] - (p[N+1+i] - p[i]) p[i+1] p i+1 i 1 p[i+1] - (p[N+1+i] - p[i]) p[i+1] p i+1 i 1 (p[N+1+i] - p[i]) p[N+1+i] p N+1+i N+1+i N 1 i p[i] p i {
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                } D = D + p[i] + p[i+1] D D + p[i] + p[i+1] D + p[i] + p[i+1] D p[i] p i p[i+1] p i+1 i 1 p[i+1] = 0 p[i+1] p i+1 i 1 0 System.out.println(D) System.out.println System.out System System.out D String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] p = new long[2*N+1];
        long D = 0;
        
        for(int i = 0; i < 2*N+1; i++){
            p[i] = sc.nextLong();
        }
        
        for(int i = 0; i < N; i++){
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        }
        
        System.out.println(D);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] p = new long[2*N+1];
        long D = 0;
        
        for(int i = 0; i < 2*N+1; i++){
            p[i] = sc.nextLong();
        }
        
        for(int i = 0; i < N; i++){
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        }
        
        System.out.println(D);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] p = new long[2*N+1];
        long D = 0;
        
        for(int i = 0; i < 2*N+1; i++){
            p[i] = sc.nextLong();
        }
        
        for(int i = 0; i < N; i++){
            if(p[i] - p[N+1+i] >= 0){
                D = D + p[N+1+i];
            }else{
                if(p[i+1] - (p[N+1+i] - p[i]) >= 0){
                    D = D + p[N+1+i];
                    p[i+1] = p[i+1] - (p[N+1+i] - p[i]);
                }else{
                    D = D + p[i] + p[i+1];
                    p[i+1] = 0;
                }
            }
        }
        
        System.out.println(D);
    }
}