import java.io.*;
import java.util.*;


public class Main {

    private static BufferedReader br;
    private static StreamTokenizer st;
    private static PrintWriter pw;

    static final int INF = 1000000007;
    static final int MOD = 1000000007;

    private static void solve() throws IOException {
        int n = nextInt();
        int a[] = new int[n + 1];
        long res = 0;
        for (int i = 0; i <= n; i++) {
            a[i] = nextInt();
        }
        for (int i = 0; i < n; i++) {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        }
        pw.println(res);
    }

    static long gcd(long a, long b) {
        if (a < b) {
            a ^= b;
            b ^= a;
            a ^= b;
        }
        while (b != 0) {
            long t = a % b;
            a = b;
            b = t;
        }
        return a;
    }

    static long inv(long t, long p) {
        return t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p;
    }

    public static void main(String args[]) throws IOException {
//        System.out.println(System.getProperty("java.library.path"));

//        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
//        if (!oj) {
//            System.setIn(new FileInputStream("src/in.txt"));
//            System.setOut(new PrintStream("out.txt"));
//        }
        br = new BufferedReader(new InputStreamReader(System.in));
        st = new StreamTokenizer(br);
        pw = new PrintWriter(new OutputStreamWriter(System.out));
        st.ordinaryChar('\'');
        st.ordinaryChar('\"');
        st.ordinaryChar('/');

//        long t = System.currentTimeMillis();
        solve();
//        if (!oj) {
//            pw.println("[" + (System.currentTimeMillis() - t) + "ms]");
//        }
        pw.flush();
    }

    private static long[] anLong(int n) throws IOException {
        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    private static String next(int len) throws IOException {
        int b = br.read();
        while (b == '\n' || b == ' ' || b == '\r' || b == '\t') {
            b = br.read();
        }
        char ch[] = new char[len];
        ch[0] = (char) b;
        int idx = 1;
        while (idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t') {
            ch[idx++] = (char) b;
        }
        return String.valueOf(ch).trim();
    }

    private static int nextInt() throws IOException {
        st.nextToken();
        return (int) st.nval;
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(nextLine());
    }

    private static double nextDouble() throws IOException {
        st.nextToken();
        return st.nval;
    }

    private static String[] nextSS(String reg) throws IOException {
        return br.readLine().split(reg);
    }

    private static String nextLine() throws IOException {
        return br.readLine();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {

    private static BufferedReader br;
    private static StreamTokenizer st;
    private static PrintWriter pw;

    static final int INF = 1000000007;
    static final int MOD = 1000000007;

    private static void solve() throws IOException {
        int n = nextInt();
        int a[] = new int[n + 1];
        long res = 0;
        for (int i = 0; i <= n; i++) {
            a[i] = nextInt();
        }
        for (int i = 0; i < n; i++) {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        }
        pw.println(res);
    }

    static long gcd(long a, long b) {
        if (a < b) {
            a ^= b;
            b ^= a;
            a ^= b;
        }
        while (b != 0) {
            long t = a % b;
            a = b;
            b = t;
        }
        return a;
    }

    static long inv(long t, long p) {
        return t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p;
    }

    public static void main(String args[]) throws IOException {
//        System.out.println(System.getProperty("java.library.path"));

//        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
//        if (!oj) {
//            System.setIn(new FileInputStream("src/in.txt"));
//            System.setOut(new PrintStream("out.txt"));
//        }
        br = new BufferedReader(new InputStreamReader(System.in));
        st = new StreamTokenizer(br);
        pw = new PrintWriter(new OutputStreamWriter(System.out));
        st.ordinaryChar('\'');
        st.ordinaryChar('\"');
        st.ordinaryChar('/');

//        long t = System.currentTimeMillis();
        solve();
//        if (!oj) {
//            pw.println("[" + (System.currentTimeMillis() - t) + "ms]");
//        }
        pw.flush();
    }

    private static long[] anLong(int n) throws IOException {
        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    private static String next(int len) throws IOException {
        int b = br.read();
        while (b == '\n' || b == ' ' || b == '\r' || b == '\t') {
            b = br.read();
        }
        char ch[] = new char[len];
        ch[0] = (char) b;
        int idx = 1;
        while (idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t') {
            ch[idx++] = (char) b;
        }
        return String.valueOf(ch).trim();
    }

    private static int nextInt() throws IOException {
        st.nextToken();
        return (int) st.nval;
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(nextLine());
    }

    private static double nextDouble() throws IOException {
        st.nextToken();
        return st.nval;
    }

    private static String[] nextSS(String reg) throws IOException {
        return br.readLine().split(reg);
    }

    private static String nextLine() throws IOException {
        return br.readLine();
    }
} Main private static BufferedReader br; br private static StreamTokenizer st; st private static PrintWriter pw; pw static final int INF = 1000000007; INF 1000000007 static final int MOD = 1000000007; MOD 1000000007 private static void solve() throws IOException {
        int n = nextInt();
        int a[] = new int[n + 1];
        long res = 0;
        for (int i = 0; i <= n; i++) {
            a[i] = nextInt();
        }
        for (int i = 0; i < n; i++) {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        }
        pw.println(res);
    } solve {
        int n = nextInt();
        int a[] = new int[n + 1];
        long res = 0;
        for (int i = 0; i <= n; i++) {
            a[i] = nextInt();
        }
        for (int i = 0; i < n; i++) {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        }
        pw.println(res);
    } int n = nextInt(); n nextInt() nextInt int a[] = new int[n + 1]; a new int[n + 1] n + 1 n 1 long res = 0; res 0 for (int i = 0; i <= n; i++) {
            a[i] = nextInt();
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
            a[i] = nextInt();
        } {
            a[i] = nextInt();
        } a[i] = nextInt() a[i] a i nextInt() nextInt for (int i = 0; i < n; i++) {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        } {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        } int b = nextInt(); b nextInt() nextInt res += Math.min(b, a[i] + a[i + 1]) res Math.min(b, a[i] + a[i + 1]) Math.min Math b a[i] + a[i + 1] a[i] a i a[i + 1] a i + 1 i 1 a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i])) a[i + 1] a i + 1 i 1 Math.min(a[i + 1], Math.max(0, b - a[i])) Math.min Math a[i + 1] a i + 1 i 1 Math.max(0, b - a[i]) Math.max Math 0 b - a[i] b a[i] a i pw.println(res) pw.println pw res static long gcd(long a, long b) {
        if (a < b) {
            a ^= b;
            b ^= a;
            a ^= b;
        }
        while (b != 0) {
            long t = a % b;
            a = b;
            b = t;
        }
        return a;
    } gcd {
        if (a < b) {
            a ^= b;
            b ^= a;
            a ^= b;
        }
        while (b != 0) {
            long t = a % b;
            a = b;
            b = t;
        }
        return a;
    } if (a < b) {
            a ^= b;
            b ^= a;
            a ^= b;
        } a < b a b {
            a ^= b;
            b ^= a;
            a ^= b;
        } a ^= b a b b ^= a b a a ^= b a b while (b != 0) {
            long t = a % b;
            a = b;
            b = t;
        } b != 0 b 0 {
            long t = a % b;
            a = b;
            b = t;
        } long t = a % b; t a % b a b a = b a b b = t b t return a; a long a a long b b static long inv(long t, long p) {
        return t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p;
    } inv {
        return t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p;
    } return t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p; t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p t == 1 t 1 1 (p - p / t) * inv(p % t, p) % p (p - p / t) * inv(p % t, p) (p - p / t) p p / t p t inv(p % t, p) inv p % t p t p p long t t long p p public static void main(String args[]) throws IOException {
//        System.out.println(System.getProperty("java.library.path"));

//        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
//        if (!oj) {
//            System.setIn(new FileInputStream("src/in.txt"));
//            System.setOut(new PrintStream("out.txt"));
//        }
        br = new BufferedReader(new InputStreamReader(System.in));
        st = new StreamTokenizer(br);
        pw = new PrintWriter(new OutputStreamWriter(System.out));
        st.ordinaryChar('\'');
        st.ordinaryChar('\"');
        st.ordinaryChar('/');

//        long t = System.currentTimeMillis();
        solve();
//        if (!oj) {
//            pw.println("[" + (System.currentTimeMillis() - t) + "ms]");
//        }
        pw.flush();
    } main {
//        System.out.println(System.getProperty("java.library.path"));

//        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
//        if (!oj) {
//            System.setIn(new FileInputStream("src/in.txt"));
//            System.setOut(new PrintStream("out.txt"));
//        }
        br = new BufferedReader(new InputStreamReader(System.in));
        st = new StreamTokenizer(br);
        pw = new PrintWriter(new OutputStreamWriter(System.out));
        st.ordinaryChar('\'');
        st.ordinaryChar('\"');
        st.ordinaryChar('/');

//        long t = System.currentTimeMillis();
        solve();
//        if (!oj) {
//            pw.println("[" + (System.currentTimeMillis() - t) + "ms]");
//        }
        pw.flush();
    } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) st = new StreamTokenizer(br) st new StreamTokenizer(br) pw = new PrintWriter(new OutputStreamWriter(System.out)) pw new PrintWriter(new OutputStreamWriter(System.out)) st.ordinaryChar('\'') st.ordinaryChar st '\'' st.ordinaryChar('\"') st.ordinaryChar st '\"' st.ordinaryChar('/') st.ordinaryChar st '/' solve() solve pw.flush() pw.flush pw String args[] args private static long[] anLong(int n) throws IOException {
        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    } anLong {
        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    } long a[] = new long[n]; a new long[n] n for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = nextInt();
        } {
            a[i] = nextInt();
        } a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n private static String next(int len) throws IOException {
        int b = br.read();
        while (b == '\n' || b == ' ' || b == '\r' || b == '\t') {
            b = br.read();
        }
        char ch[] = new char[len];
        ch[0] = (char) b;
        int idx = 1;
        while (idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t') {
            ch[idx++] = (char) b;
        }
        return String.valueOf(ch).trim();
    } next {
        int b = br.read();
        while (b == '\n' || b == ' ' || b == '\r' || b == '\t') {
            b = br.read();
        }
        char ch[] = new char[len];
        ch[0] = (char) b;
        int idx = 1;
        while (idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t') {
            ch[idx++] = (char) b;
        }
        return String.valueOf(ch).trim();
    } int b = br.read(); b br.read() br.read br while (b == '\n' || b == ' ' || b == '\r' || b == '\t') {
            b = br.read();
        } b == '\n' || b == ' ' || b == '\r' || b == '\t' b == '\r' b == '\n' || b == ' ' || b == '\r' || b == '\t' b == '\n' b '\n' b == ' ' b ' ' b == '\r' b '\r' b == '\t' b '\t' {
            b = br.read();
        } b = br.read() b br.read() br.read br char ch[] = new char[len]; ch new char[len] len ch[0] = (char) b ch[0] ch 0 (char) b int idx = 1; idx 1 while (idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t') {
            ch[idx++] = (char) b;
        } idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t' b != '\r' b != '\n' idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t' idx < len idx len (b = br.read()) != ' ' (b = br.read()) b br.read() br.read br ' ' b != '\n' b '\n' b != '\r' b '\r' b != '\t' b '\t' {
            ch[idx++] = (char) b;
        } ch[idx++] = (char) b ch[idx++] ch idx++ idx (char) b return String.valueOf(ch).trim(); String.valueOf(ch).trim() String.valueOf(ch).trim String.valueOf(ch) String.valueOf String ch int len len private static int nextInt() throws IOException {
        st.nextToken();
        return (int) st.nval;
    } nextInt {
        st.nextToken();
        return (int) st.nval;
    } st.nextToken() st.nextToken st return (int) st.nval; (int) st.nval st st.nval private static long nextLong() throws IOException {
        return Long.parseLong(nextLine());
    } nextLong {
        return Long.parseLong(nextLine());
    } return Long.parseLong(nextLine()); Long.parseLong(nextLine()) Long.parseLong Long nextLine() nextLine private static double nextDouble() throws IOException {
        st.nextToken();
        return st.nval;
    } nextDouble {
        st.nextToken();
        return st.nval;
    } st.nextToken() st.nextToken st return st.nval; st.nval st st.nval private static String[] nextSS(String reg) throws IOException {
        return br.readLine().split(reg);
    } nextSS {
        return br.readLine().split(reg);
    } return br.readLine().split(reg); br.readLine().split(reg) br.readLine().split br.readLine() br.readLine br reg String reg reg private static String nextLine() throws IOException {
        return br.readLine();
    } nextLine {
        return br.readLine();
    } return br.readLine(); br.readLine() br.readLine br public class Main {

    private static BufferedReader br;
    private static StreamTokenizer st;
    private static PrintWriter pw;

    static final int INF = 1000000007;
    static final int MOD = 1000000007;

    private static void solve() throws IOException {
        int n = nextInt();
        int a[] = new int[n + 1];
        long res = 0;
        for (int i = 0; i <= n; i++) {
            a[i] = nextInt();
        }
        for (int i = 0; i < n; i++) {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        }
        pw.println(res);
    }

    static long gcd(long a, long b) {
        if (a < b) {
            a ^= b;
            b ^= a;
            a ^= b;
        }
        while (b != 0) {
            long t = a % b;
            a = b;
            b = t;
        }
        return a;
    }

    static long inv(long t, long p) {
        return t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p;
    }

    public static void main(String args[]) throws IOException {
//        System.out.println(System.getProperty("java.library.path"));

//        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
//        if (!oj) {
//            System.setIn(new FileInputStream("src/in.txt"));
//            System.setOut(new PrintStream("out.txt"));
//        }
        br = new BufferedReader(new InputStreamReader(System.in));
        st = new StreamTokenizer(br);
        pw = new PrintWriter(new OutputStreamWriter(System.out));
        st.ordinaryChar('\'');
        st.ordinaryChar('\"');
        st.ordinaryChar('/');

//        long t = System.currentTimeMillis();
        solve();
//        if (!oj) {
//            pw.println("[" + (System.currentTimeMillis() - t) + "ms]");
//        }
        pw.flush();
    }

    private static long[] anLong(int n) throws IOException {
        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    private static String next(int len) throws IOException {
        int b = br.read();
        while (b == '\n' || b == ' ' || b == '\r' || b == '\t') {
            b = br.read();
        }
        char ch[] = new char[len];
        ch[0] = (char) b;
        int idx = 1;
        while (idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t') {
            ch[idx++] = (char) b;
        }
        return String.valueOf(ch).trim();
    }

    private static int nextInt() throws IOException {
        st.nextToken();
        return (int) st.nval;
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(nextLine());
    }

    private static double nextDouble() throws IOException {
        st.nextToken();
        return st.nval;
    }

    private static String[] nextSS(String reg) throws IOException {
        return br.readLine().split(reg);
    }

    private static String nextLine() throws IOException {
        return br.readLine();
    }
} public class Main {

    private static BufferedReader br;
    private static StreamTokenizer st;
    private static PrintWriter pw;

    static final int INF = 1000000007;
    static final int MOD = 1000000007;

    private static void solve() throws IOException {
        int n = nextInt();
        int a[] = new int[n + 1];
        long res = 0;
        for (int i = 0; i <= n; i++) {
            a[i] = nextInt();
        }
        for (int i = 0; i < n; i++) {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        }
        pw.println(res);
    }

    static long gcd(long a, long b) {
        if (a < b) {
            a ^= b;
            b ^= a;
            a ^= b;
        }
        while (b != 0) {
            long t = a % b;
            a = b;
            b = t;
        }
        return a;
    }

    static long inv(long t, long p) {
        return t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p;
    }

    public static void main(String args[]) throws IOException {
//        System.out.println(System.getProperty("java.library.path"));

//        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
//        if (!oj) {
//            System.setIn(new FileInputStream("src/in.txt"));
//            System.setOut(new PrintStream("out.txt"));
//        }
        br = new BufferedReader(new InputStreamReader(System.in));
        st = new StreamTokenizer(br);
        pw = new PrintWriter(new OutputStreamWriter(System.out));
        st.ordinaryChar('\'');
        st.ordinaryChar('\"');
        st.ordinaryChar('/');

//        long t = System.currentTimeMillis();
        solve();
//        if (!oj) {
//            pw.println("[" + (System.currentTimeMillis() - t) + "ms]");
//        }
        pw.flush();
    }

    private static long[] anLong(int n) throws IOException {
        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    private static String next(int len) throws IOException {
        int b = br.read();
        while (b == '\n' || b == ' ' || b == '\r' || b == '\t') {
            b = br.read();
        }
        char ch[] = new char[len];
        ch[0] = (char) b;
        int idx = 1;
        while (idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t') {
            ch[idx++] = (char) b;
        }
        return String.valueOf(ch).trim();
    }

    private static int nextInt() throws IOException {
        st.nextToken();
        return (int) st.nval;
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(nextLine());
    }

    private static double nextDouble() throws IOException {
        st.nextToken();
        return st.nval;
    }

    private static String[] nextSS(String reg) throws IOException {
        return br.readLine().split(reg);
    }

    private static String nextLine() throws IOException {
        return br.readLine();
    }
} Main
import java.io.*;
import java.util.*;


public class Main {

    private static BufferedReader br;
    private static StreamTokenizer st;
    private static PrintWriter pw;

    static final int INF = 1000000007;
    static final int MOD = 1000000007;

    private static void solve() throws IOException {
        int n = nextInt();
        int a[] = new int[n + 1];
        long res = 0;
        for (int i = 0; i <= n; i++) {
            a[i] = nextInt();
        }
        for (int i = 0; i < n; i++) {
            int b = nextInt();
            res += Math.min(b, a[i] + a[i + 1]);
            a[i + 1] -= Math.min(a[i + 1], Math.max(0, b - a[i]));
        }
        pw.println(res);
    }

    static long gcd(long a, long b) {
        if (a < b) {
            a ^= b;
            b ^= a;
            a ^= b;
        }
        while (b != 0) {
            long t = a % b;
            a = b;
            b = t;
        }
        return a;
    }

    static long inv(long t, long p) {
        return t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p;
    }

    public static void main(String args[]) throws IOException {
//        System.out.println(System.getProperty("java.library.path"));

//        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
//        if (!oj) {
//            System.setIn(new FileInputStream("src/in.txt"));
//            System.setOut(new PrintStream("out.txt"));
//        }
        br = new BufferedReader(new InputStreamReader(System.in));
        st = new StreamTokenizer(br);
        pw = new PrintWriter(new OutputStreamWriter(System.out));
        st.ordinaryChar('\'');
        st.ordinaryChar('\"');
        st.ordinaryChar('/');

//        long t = System.currentTimeMillis();
        solve();
//        if (!oj) {
//            pw.println("[" + (System.currentTimeMillis() - t) + "ms]");
//        }
        pw.flush();
    }

    private static long[] anLong(int n) throws IOException {
        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    private static String next(int len) throws IOException {
        int b = br.read();
        while (b == '\n' || b == ' ' || b == '\r' || b == '\t') {
            b = br.read();
        }
        char ch[] = new char[len];
        ch[0] = (char) b;
        int idx = 1;
        while (idx < len && (b = br.read()) != ' ' && b != '\n' && b != '\r' && b != '\t') {
            ch[idx++] = (char) b;
        }
        return String.valueOf(ch).trim();
    }

    private static int nextInt() throws IOException {
        st.nextToken();
        return (int) st.nval;
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(nextLine());
    }

    private static double nextDouble() throws IOException {
        st.nextToken();
        return st.nval;
    }

    private static String[] nextSS(String reg) throws IOException {
        return br.readLine().split(reg);
    }

    private static String nextLine() throws IOException {
        return br.readLine();
    }
}