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

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

        int N = Integer.parseInt(sc.next());
        int[] A = new int[N+1];
        int[] B = new int[N];
        for (int i = 0; i < N + 1; i++) {
            A[i] = Integer.parseInt(sc.next());
        }
        for (int i = 0; i < N; i++) {
            B[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        long sum = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 2; j++) {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            }
        }

        out.printf("%d\n", sum);
        out.flush();
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(sc.next());
        int[] A = new int[N+1];
        int[] B = new int[N];
        for (int i = 0; i < N + 1; i++) {
            A[i] = Integer.parseInt(sc.next());
        }
        for (int i = 0; i < N; i++) {
            B[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        long sum = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 2; j++) {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            }
        }

        out.printf("%d\n", sum);
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(sc.next());
        int[] A = new int[N+1];
        int[] B = new int[N];
        for (int i = 0; i < N + 1; i++) {
            A[i] = Integer.parseInt(sc.next());
        }
        for (int i = 0; i < N; i++) {
            B[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        long sum = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 2; j++) {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            }
        }

        out.printf("%d\n", sum);
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(sc.next());
        int[] A = new int[N+1];
        int[] B = new int[N];
        for (int i = 0; i < N + 1; i++) {
            A[i] = Integer.parseInt(sc.next());
        }
        for (int i = 0; i < N; i++) {
            B[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        long sum = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 2; j++) {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            }
        }

        out.printf("%d\n", sum);
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] A = new int[N+1]; A new int[N+1] N+1 N 1 int[] B = new int[N]; B new int[N] N for (int i = 0; i < N + 1; i++) {
            A[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < N + 1 i N + 1 N 1 i++ i++ i {
            A[i] = Integer.parseInt(sc.next());
        } {
            A[i] = Integer.parseInt(sc.next());
        } A[i] = Integer.parseInt(sc.next()) A[i] A i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int i = 0; i < N; i++) {
            B[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            B[i] = Integer.parseInt(sc.next());
        } {
            B[i] = Integer.parseInt(sc.next());
        } B[i] = Integer.parseInt(sc.next()) B[i] B i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc long sum = 0; sum 0 for (int i = 0; i < N; i++) {
            for (int j = 0; j < 2; j++) {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            for (int j = 0; j < 2; j++) {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            }
        } {
            for (int j = 0; j < 2; j++) {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            }
        } for (int j = 0; j < 2; j++) {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            } int j = 0; int j = 0; j 0 j < 2 j 2 j++ j++ j {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            } {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            } if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                } A[i + j] <= B[i] A[i + j] A i + j i j B[i] B i {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } sum += A[i + j] sum A[i + j] A i + j i j B[i] -= A[i + j] B[i] B i A[i + j] A i + j i j A[i + j] = 0 A[i + j] A i + j i j 0 {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                } sum += B[i] sum B[i] B i A[i + j] -= B[i] A[i + j] A i + j i j B[i] B i B[i] = 0 B[i] B i 0 out.printf("%d\n", sum) out.printf out "%d\n" sum out.flush() out.flush out String[] args args
import java.util.*;
import java.io.*;

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

        int N = Integer.parseInt(sc.next());
        int[] A = new int[N+1];
        int[] B = new int[N];
        for (int i = 0; i < N + 1; i++) {
            A[i] = Integer.parseInt(sc.next());
        }
        for (int i = 0; i < N; i++) {
            B[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        long sum = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 2; j++) {
                if (A[i + j] <= B[i]) {
                    sum += A[i + j];
                    B[i] -= A[i + j];
                    A[i + j] = 0;
                } else {
                    sum += B[i];
                    A[i + j] -= B[i];
                    B[i] = 0;
                }
            }
        }

        out.printf("%d\n", sum);
        out.flush();
    }
}
