import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N + 1];
        int[] B = new int[N];

        for (int i = 0; i < N + 1; i++) {
            A[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            B[i] = sc.nextInt();
        }

        long sum = 0;
        int carry = 0;
        for (int i = 0; i < N + 1; i++) {
            if (A[i] >= carry) {
                A[i] -= carry;
                sum += carry;
            } else {
                sum += A[i];
                A[i] = 0;
            }

            if (i == N) {
                break;
            }

            if (B[i] > A[i]) {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } else {
                sum += B[i];
                carry = 0;
            }
        }

        System.out.println(sum);
        return;
    }

} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
} Main public static void main(String[] args) {
        new Solver().run();
    } main {
        new Solver().run();
    } new Solver().run() new Solver().run new Solver() String[] args args class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N + 1];
        int[] B = new int[N];

        for (int i = 0; i < N + 1; i++) {
            A[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            B[i] = sc.nextInt();
        }

        long sum = 0;
        int carry = 0;
        for (int i = 0; i < N + 1; i++) {
            if (A[i] >= carry) {
                A[i] -= carry;
                sum += carry;
            } else {
                sum += A[i];
                A[i] = 0;
            }

            if (i == N) {
                break;
            }

            if (B[i] > A[i]) {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } else {
                sum += B[i];
                carry = 0;
            }
        }

        System.out.println(sum);
        return;
    }

} Solver public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N + 1];
        int[] B = new int[N];

        for (int i = 0; i < N + 1; i++) {
            A[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            B[i] = sc.nextInt();
        }

        long sum = 0;
        int carry = 0;
        for (int i = 0; i < N + 1; i++) {
            if (A[i] >= carry) {
                A[i] -= carry;
                sum += carry;
            } else {
                sum += A[i];
                A[i] = 0;
            }

            if (i == N) {
                break;
            }

            if (B[i] > A[i]) {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } else {
                sum += B[i];
                carry = 0;
            }
        }

        System.out.println(sum);
        return;
    } run {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N + 1];
        int[] B = new int[N];

        for (int i = 0; i < N + 1; i++) {
            A[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            B[i] = sc.nextInt();
        }

        long sum = 0;
        int carry = 0;
        for (int i = 0; i < N + 1; i++) {
            if (A[i] >= carry) {
                A[i] -= carry;
                sum += carry;
            } else {
                sum += A[i];
                A[i] = 0;
            }

            if (i == N) {
                break;
            }

            if (B[i] > A[i]) {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } else {
                sum += B[i];
                carry = 0;
            }
        }

        System.out.println(sum);
        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt 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] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N + 1 i N + 1 N 1 i++ i++ i {
            A[i] = sc.nextInt();
        } {
            A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc for (int i = 0; i < N; i++) {
            B[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            B[i] = sc.nextInt();
        } {
            B[i] = sc.nextInt();
        } B[i] = sc.nextInt() B[i] B i sc.nextInt() sc.nextInt sc long sum = 0; sum 0 int carry = 0; carry 0 for (int i = 0; i < N + 1; i++) {
            if (A[i] >= carry) {
                A[i] -= carry;
                sum += carry;
            } else {
                sum += A[i];
                A[i] = 0;
            }

            if (i == N) {
                break;
            }

            if (B[i] > A[i]) {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } else {
                sum += B[i];
                carry = 0;
            }
        } int i = 0; int i = 0; i 0 i < N + 1 i N + 1 N 1 i++ i++ i {
            if (A[i] >= carry) {
                A[i] -= carry;
                sum += carry;
            } else {
                sum += A[i];
                A[i] = 0;
            }

            if (i == N) {
                break;
            }

            if (B[i] > A[i]) {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } else {
                sum += B[i];
                carry = 0;
            }
        } {
            if (A[i] >= carry) {
                A[i] -= carry;
                sum += carry;
            } else {
                sum += A[i];
                A[i] = 0;
            }

            if (i == N) {
                break;
            }

            if (B[i] > A[i]) {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } else {
                sum += B[i];
                carry = 0;
            }
        } if (A[i] >= carry) {
                A[i] -= carry;
                sum += carry;
            } else {
                sum += A[i];
                A[i] = 0;
            } A[i] >= carry A[i] A i carry {
                A[i] -= carry;
                sum += carry;
            } A[i] -= carry A[i] A i carry sum += carry sum carry {
                sum += A[i];
                A[i] = 0;
            } sum += A[i] sum A[i] A i A[i] = 0 A[i] A i 0 if (i == N) {
                break;
            } i == N i N {
                break;
            } break; if (B[i] > A[i]) {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } else {
                sum += B[i];
                carry = 0;
            } B[i] > A[i] B[i] B i A[i] A i {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } int diff = B[i] - A[i]; diff B[i] - A[i] B[i] B i A[i] A i sum += A[i] sum A[i] A i carry = diff carry diff {
                sum += B[i];
                carry = 0;
            } sum += B[i] sum B[i] B i carry = 0 carry 0 System.out.println(sum) System.out.println System.out System System.out sum return;
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N + 1];
        int[] B = new int[N];

        for (int i = 0; i < N + 1; i++) {
            A[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            B[i] = sc.nextInt();
        }

        long sum = 0;
        int carry = 0;
        for (int i = 0; i < N + 1; i++) {
            if (A[i] >= carry) {
                A[i] -= carry;
                sum += carry;
            } else {
                sum += A[i];
                A[i] = 0;
            }

            if (i == N) {
                break;
            }

            if (B[i] > A[i]) {
                int diff = B[i] - A[i];
                sum += A[i];
                carry = diff;
            } else {
                sum += B[i];
                carry = 0;
            }
        }

        System.out.println(sum);
        return;
    }

}