import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Xinyi Tao
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCitySaversABC135 solver = new CCitySaversABC135();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCitySaversABC135 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n + 1];
            long[] b = new long[n];
            for (int i = 0; i < n + 1; i++)
                a[i] = in.nextLong();
            long c = 0;
            for (int i = 0; i < n; i++) {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            }
            out.println(c);


        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCitySaversABC135 solver = new CCitySaversABC135();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCitySaversABC135 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n + 1];
            long[] b = new long[n];
            for (int i = 0; i < n + 1; i++)
                a[i] = in.nextLong();
            long c = 0;
            for (int i = 0; i < n; i++) {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            }
            out.println(c);


        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCitySaversABC135 solver = new CCitySaversABC135();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCitySaversABC135 solver = new CCitySaversABC135();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) CCitySaversABC135 solver = new CCitySaversABC135(); solver new CCitySaversABC135() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class CCitySaversABC135 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n + 1];
            long[] b = new long[n];
            for (int i = 0; i < n + 1; i++)
                a[i] = in.nextLong();
            long c = 0;
            for (int i = 0; i < n; i++) {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            }
            out.println(c);


        }

    } CCitySaversABC135 public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n + 1];
            long[] b = new long[n];
            for (int i = 0; i < n + 1; i++)
                a[i] = in.nextLong();
            long c = 0;
            for (int i = 0; i < n; i++) {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            }
            out.println(c);


        } solve {
            int n = in.nextInt();
            long[] a = new long[n + 1];
            long[] b = new long[n];
            for (int i = 0; i < n + 1; i++)
                a[i] = in.nextLong();
            long c = 0;
            for (int i = 0; i < n; i++) {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            }
            out.println(c);


        } int n = in.nextInt(); n in.nextInt() in.nextInt in long[] a = new long[n + 1]; a new long[n + 1] n + 1 n 1 long[] b = new long[n]; b new long[n] n for (int i = 0; i < n + 1; i++)
                a[i] = in.nextLong(); int i = 0; int i = 0; i 0 i < n + 1 i n + 1 n 1 i++ i++ i a[i] = in.nextLong(); a[i] = in.nextLong() a[i] a i in.nextLong() in.nextLong in long c = 0; c 0 for (int i = 0; i < n; i++) {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            } {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            } long v = in.nextLong(); v in.nextLong() in.nextLong in long c1 = Math.min(a[i], v); c1 Math.min(a[i], v) Math.min Math a[i] a i v c += c1 c c1 long c2 = Math.min(v - c1, a[i + 1]); c2 Math.min(v - c1, a[i + 1]) Math.min Math v - c1 v c1 a[i + 1] a i + 1 i 1 c += c2 c c2 a[i + 1] -= c2 a[i + 1] a i + 1 i 1 c2 out.println(c) out.println out c int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCitySaversABC135 solver = new CCitySaversABC135();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCitySaversABC135 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n + 1];
            long[] b = new long[n];
            for (int i = 0; i < n + 1; i++)
                a[i] = in.nextLong();
            long c = 0;
            for (int i = 0; i < n; i++) {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            }
            out.println(c);


        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCitySaversABC135 solver = new CCitySaversABC135();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCitySaversABC135 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n + 1];
            long[] b = new long[n];
            for (int i = 0; i < n + 1; i++)
                a[i] = in.nextLong();
            long c = 0;
            for (int i = 0; i < n; i++) {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            }
            out.println(c);


        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Xinyi Tao
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCitySaversABC135 solver = new CCitySaversABC135();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCitySaversABC135 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n + 1];
            long[] b = new long[n];
            for (int i = 0; i < n + 1; i++)
                a[i] = in.nextLong();
            long c = 0;
            for (int i = 0; i < n; i++) {
                long v = in.nextLong();
                long c1 = Math.min(a[i], v);
                c += c1;
                long c2 = Math.min(v - c1, a[i + 1]);
                c += c2;
                a[i + 1] -= c2;
            }
            out.println(c);


        }

    }
}

