/*
 * @Author: Kaustav Vats  
 */
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;


class Main {

    public static void PrintIntArray(int[] Arr) {
        for (int i=0; i<Arr.length; i++) {
            System.out.print(Arr[i] + " ");
        }
        System.out.println();
    }

    public static void main(String[] args) throws IOException{
        Reader.init(System.in);
        int N = Reader.nextInt();
        long[] Arr = new long[N+1];
        long[] Brr = new long[N];
        for (int i=0; i<=N; i++) {
            Arr[i] = Reader.nextLong();
        }
        for (int i=0; i<N; i++) {
            Brr[i] = Reader.nextLong();
        }
        long count = 0;
        int i = 0;
        
        while(i < N) {
            if (Arr[i] < Brr[i]) {
                count += Arr[i];
                Brr[i] -= Arr[i];
                Arr[i] = 0;
                if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                }
            }
            else {
                count += Brr[i];
                Brr[i] = 0;
            }
            i++;
        }
        System.out.println(count);
    }
}


/** Class for buffered reading int and double values */
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
	
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
} import java.io.*; io.* java import java.util.*; util.* java import java.math.*; math.* java import java.lang.*; lang.* java class Main {

    public static void PrintIntArray(int[] Arr) {
        for (int i=0; i<Arr.length; i++) {
            System.out.print(Arr[i] + " ");
        }
        System.out.println();
    }

    public static void main(String[] args) throws IOException{
        Reader.init(System.in);
        int N = Reader.nextInt();
        long[] Arr = new long[N+1];
        long[] Brr = new long[N];
        for (int i=0; i<=N; i++) {
            Arr[i] = Reader.nextLong();
        }
        for (int i=0; i<N; i++) {
            Brr[i] = Reader.nextLong();
        }
        long count = 0;
        int i = 0;
        
        while(i < N) {
            if (Arr[i] < Brr[i]) {
                count += Arr[i];
                Brr[i] -= Arr[i];
                Arr[i] = 0;
                if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                }
            }
            else {
                count += Brr[i];
                Brr[i] = 0;
            }
            i++;
        }
        System.out.println(count);
    }
} Main public static void PrintIntArray(int[] Arr) {
        for (int i=0; i<Arr.length; i++) {
            System.out.print(Arr[i] + " ");
        }
        System.out.println();
    } PrintIntArray {
        for (int i=0; i<Arr.length; i++) {
            System.out.print(Arr[i] + " ");
        }
        System.out.println();
    } for (int i=0; i<Arr.length; i++) {
            System.out.print(Arr[i] + " ");
        } int i=0; int i=0; i 0 i<Arr.length i Arr.length Arr Arr.length i++ i++ i {
            System.out.print(Arr[i] + " ");
        } {
            System.out.print(Arr[i] + " ");
        } System.out.print(Arr[i] + " ") System.out.print System.out System System.out Arr[i] + " " Arr[i] Arr i " " System.out.println() System.out.println System.out System System.out int[] Arr Arr public static void main(String[] args) throws IOException{
        Reader.init(System.in);
        int N = Reader.nextInt();
        long[] Arr = new long[N+1];
        long[] Brr = new long[N];
        for (int i=0; i<=N; i++) {
            Arr[i] = Reader.nextLong();
        }
        for (int i=0; i<N; i++) {
            Brr[i] = Reader.nextLong();
        }
        long count = 0;
        int i = 0;
        
        while(i < N) {
            if (Arr[i] < Brr[i]) {
                count += Arr[i];
                Brr[i] -= Arr[i];
                Arr[i] = 0;
                if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                }
            }
            else {
                count += Brr[i];
                Brr[i] = 0;
            }
            i++;
        }
        System.out.println(count);
    } main {
        Reader.init(System.in);
        int N = Reader.nextInt();
        long[] Arr = new long[N+1];
        long[] Brr = new long[N];
        for (int i=0; i<=N; i++) {
            Arr[i] = Reader.nextLong();
        }
        for (int i=0; i<N; i++) {
            Brr[i] = Reader.nextLong();
        }
        long count = 0;
        int i = 0;
        
        while(i < N) {
            if (Arr[i] < Brr[i]) {
                count += Arr[i];
                Brr[i] -= Arr[i];
                Arr[i] = 0;
                if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                }
            }
            else {
                count += Brr[i];
                Brr[i] = 0;
            }
            i++;
        }
        System.out.println(count);
    } Reader.init(System.in) Reader.init Reader System.in System System.in int N = Reader.nextInt(); N Reader.nextInt() Reader.nextInt Reader long[] Arr = new long[N+1]; Arr new long[N+1] N+1 N 1 long[] Brr = new long[N]; Brr new long[N] N for (int i=0; i<=N; i++) {
            Arr[i] = Reader.nextLong();
        } int i=0; int i=0; i 0 i<=N i N i++ i++ i {
            Arr[i] = Reader.nextLong();
        } {
            Arr[i] = Reader.nextLong();
        } Arr[i] = Reader.nextLong() Arr[i] Arr i Reader.nextLong() Reader.nextLong Reader for (int i=0; i<N; i++) {
            Brr[i] = Reader.nextLong();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            Brr[i] = Reader.nextLong();
        } {
            Brr[i] = Reader.nextLong();
        } Brr[i] = Reader.nextLong() Brr[i] Brr i Reader.nextLong() Reader.nextLong Reader long count = 0; count 0 int i = 0; i 0 while(i < N) {
            if (Arr[i] < Brr[i]) {
                count += Arr[i];
                Brr[i] -= Arr[i];
                Arr[i] = 0;
                if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                }
            }
            else {
                count += Brr[i];
                Brr[i] = 0;
            }
            i++;
        } i < N i N {
            if (Arr[i] < Brr[i]) {
                count += Arr[i];
                Brr[i] -= Arr[i];
                Arr[i] = 0;
                if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                }
            }
            else {
                count += Brr[i];
                Brr[i] = 0;
            }
            i++;
        } if (Arr[i] < Brr[i]) {
                count += Arr[i];
                Brr[i] -= Arr[i];
                Arr[i] = 0;
                if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                }
            }
            else {
                count += Brr[i];
                Brr[i] = 0;
            } Arr[i] < Brr[i] Arr[i] Arr i Brr[i] Brr i {
                count += Arr[i];
                Brr[i] -= Arr[i];
                Arr[i] = 0;
                if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                }
            } count += Arr[i] count Arr[i] Arr i Brr[i] -= Arr[i] Brr[i] Brr i Arr[i] Arr i Arr[i] = 0 Arr[i] Arr i 0 if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                } Arr[i+1] > Brr[i] Arr[i+1] Arr i+1 i 1 Brr[i] Brr i {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                } count += Brr[i] count Brr[i] Brr i Arr[i+1] -= Brr[i] Arr[i+1] Arr i+1 i 1 Brr[i] Brr i {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                } count += Arr[i+1] count Arr[i+1] Arr i+1 i 1 Brr[i] -= Arr[i+1] Brr[i] Brr i Arr[i+1] Arr i+1 i 1 Arr[i+1] = 0 Arr[i+1] Arr i+1 i 1 0 {
                count += Brr[i];
                Brr[i] = 0;
            } count += Brr[i] count Brr[i] Brr i Brr[i] = 0 Brr[i] Brr i 0 i++ i System.out.println(count) System.out.println System.out System System.out count String[] args args class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
	
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
} Reader static BufferedReader reader; reader static StringTokenizer tokenizer; tokenizer /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    } init {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    } reader = new BufferedReader(
                     new InputStreamReader(input) ) reader new BufferedReader(
                     new InputStreamReader(input) ) tokenizer = new StringTokenizer("") tokenizer new StringTokenizer("") InputStream input input /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    } next {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    } while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        } ! tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        } tokenizer = new StringTokenizer(
                   reader.readLine() ) tokenizer new StringTokenizer(
                   reader.readLine() ) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    } nextInt {
        return Integer.parseInt( next() );
    } return Integer.parseInt( next() ); Integer.parseInt( next() ) Integer.parseInt Integer next() next static long nextLong() throws IOException {
        return Long.parseLong( next() );
    } nextLong {
        return Long.parseLong( next() );
    } return Long.parseLong( next() ); Long.parseLong( next() ) Long.parseLong Long next() next static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    } nextDouble {
        return Double.parseDouble( next() );
    } return Double.parseDouble( next() ); Double.parseDouble( next() ) Double.parseDouble Double next() next
/*
 * @Author: Kaustav Vats  
 */
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;


class Main {

    public static void PrintIntArray(int[] Arr) {
        for (int i=0; i<Arr.length; i++) {
            System.out.print(Arr[i] + " ");
        }
        System.out.println();
    }

    public static void main(String[] args) throws IOException{
        Reader.init(System.in);
        int N = Reader.nextInt();
        long[] Arr = new long[N+1];
        long[] Brr = new long[N];
        for (int i=0; i<=N; i++) {
            Arr[i] = Reader.nextLong();
        }
        for (int i=0; i<N; i++) {
            Brr[i] = Reader.nextLong();
        }
        long count = 0;
        int i = 0;
        
        while(i < N) {
            if (Arr[i] < Brr[i]) {
                count += Arr[i];
                Brr[i] -= Arr[i];
                Arr[i] = 0;
                if (Arr[i+1] > Brr[i]) {
                    count += Brr[i];
                    Arr[i+1] -= Brr[i];
                }
                else {
                    count += Arr[i+1];
                    Brr[i] -= Arr[i+1];
                    Arr[i+1] = 0;
                }
            }
            else {
                count += Brr[i];
                Brr[i] = 0;
            }
            i++;
        }
        System.out.println(count);
    }
}


/** Class for buffered reading int and double values */
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
	
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}