import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int[] b = new int[a+1];
        int[] c = new int[a];
        for(int i=0;i<a+1;i++){
            int d=scan.nextInt();
            b[i]=d;
        }
        for(int i=0;i<a;i++){
            int d=scan.nextInt();
            c[i]=d;
        }
        long ans=0;
        for(int i=0;i<a;i++){
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int[] b = new int[a+1];
        int[] c = new int[a];
        for(int i=0;i<a+1;i++){
            int d=scan.nextInt();
            b[i]=d;
        }
        for(int i=0;i<a;i++){
            int d=scan.nextInt();
            c[i]=d;
        }
        long ans=0;
        for(int i=0;i<a;i++){
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int[] b = new int[a+1];
        int[] c = new int[a];
        for(int i=0;i<a+1;i++){
            int d=scan.nextInt();
            b[i]=d;
        }
        for(int i=0;i<a;i++){
            int d=scan.nextInt();
            c[i]=d;
        }
        long ans=0;
        for(int i=0;i<a;i++){
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        }
        System.out.println(ans);
    } main {
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int[] b = new int[a+1];
        int[] c = new int[a];
        for(int i=0;i<a+1;i++){
            int d=scan.nextInt();
            b[i]=d;
        }
        for(int i=0;i<a;i++){
            int d=scan.nextInt();
            c[i]=d;
        }
        long ans=0;
        for(int i=0;i<a;i++){
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        }
        System.out.println(ans);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int[] b = new int[a+1]; b new int[a+1] a+1 a 1 int[] c = new int[a]; c new int[a] a for(int i=0;i<a+1;i++){
            int d=scan.nextInt();
            b[i]=d;
        } int i=0; int i=0; i 0 i<a+1 i a+1 a 1 i++ i++ i {
            int d=scan.nextInt();
            b[i]=d;
        } {
            int d=scan.nextInt();
            b[i]=d;
        } int d=scan.nextInt(); d scan.nextInt() scan.nextInt scan b[i]=d b[i] b i d for(int i=0;i<a;i++){
            int d=scan.nextInt();
            c[i]=d;
        } int i=0; int i=0; i 0 i<a i a i++ i++ i {
            int d=scan.nextInt();
            c[i]=d;
        } {
            int d=scan.nextInt();
            c[i]=d;
        } int d=scan.nextInt(); d scan.nextInt() scan.nextInt scan c[i]=d c[i] c i d long ans=0; ans 0 for(int i=0;i<a;i++){
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        } int i=0; int i=0; i 0 i<a i a i++ i++ i {
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        } {
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        } if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            } c[i]<=b[i] c[i] c i b[i] b i {
                ans+=c[i];
            } ans+=c[i] ans c[i] c i {
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            } c[i]-=b[i] c[i] c i b[i] b i ans+=b[i] ans b[i] b i b[i]=0 b[i] b i 0 int e = i+1; e i+1 i 1 if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                } c[i]<=b[e] c[i] c i b[e] b e {
                    ans+=c[i];
                    b[e]-=c[i];
                } ans+=c[i] ans c[i] c i b[e]-=c[i] b[e] b e c[i] c i {
                    ans+=b[e];
                    b[e]=0;
                } ans+=b[e] ans b[e] b e b[e]=0 b[e] b e 0 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 scan = new Scanner(System.in);

        int a = scan.nextInt();
        int[] b = new int[a+1];
        int[] c = new int[a];
        for(int i=0;i<a+1;i++){
            int d=scan.nextInt();
            b[i]=d;
        }
        for(int i=0;i<a;i++){
            int d=scan.nextInt();
            c[i]=d;
        }
        long ans=0;
        for(int i=0;i<a;i++){
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int[] b = new int[a+1];
        int[] c = new int[a];
        for(int i=0;i<a+1;i++){
            int d=scan.nextInt();
            b[i]=d;
        }
        for(int i=0;i<a;i++){
            int d=scan.nextInt();
            c[i]=d;
        }
        long ans=0;
        for(int i=0;i<a;i++){
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        }
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int[] b = new int[a+1];
        int[] c = new int[a];
        for(int i=0;i<a+1;i++){
            int d=scan.nextInt();
            b[i]=d;
        }
        for(int i=0;i<a;i++){
            int d=scan.nextInt();
            c[i]=d;
        }
        long ans=0;
        for(int i=0;i<a;i++){
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        }
        System.out.println(ans);
    }
}