import java.util.*;

public class Main {

    public static void main(String[] args) {
        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 destroyed = 0;

        for(int i=0; i<N; i++){
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        }

        System.out.println(destroyed);

    }

    public static int destroy1(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i] < killable){
            destroyed += A[i];
            killable -= A[i];
            A[i] = 0;
            if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            }
        }else {
            destroyed += killable;
            A[i] -= killable;
        }

        return destroyed;
    }

    public static int destroy2(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i+1] < killable){
            destroyed += A[i+1];
            killable -= A[i+1];
            A[i+1] = 0;
            if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            }
        }else {
            destroyed += killable;
            A[i+1] -= killable;
        }

        return destroyed;
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        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 destroyed = 0;

        for(int i=0; i<N; i++){
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        }

        System.out.println(destroyed);

    }

    public static int destroy1(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i] < killable){
            destroyed += A[i];
            killable -= A[i];
            A[i] = 0;
            if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            }
        }else {
            destroyed += killable;
            A[i] -= killable;
        }

        return destroyed;
    }

    public static int destroy2(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i+1] < killable){
            destroyed += A[i+1];
            killable -= A[i+1];
            A[i+1] = 0;
            if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            }
        }else {
            destroyed += killable;
            A[i+1] -= killable;
        }

        return destroyed;
    }
} Main public static void main(String[] args) {
        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 destroyed = 0;

        for(int i=0; i<N; i++){
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        }

        System.out.println(destroyed);

    } main {
        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 destroyed = 0;

        for(int i=0; i<N; i++){
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        }

        System.out.println(destroyed);

    } 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 destroyed = 0; destroyed 0 for(int i=0; i<N; i++){
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        } {
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        } int j = N-1 - i; j N-1 - i N-1 - i N 1 i if(i > j){
                break;
            } i > j i j {
                break;
            } break; if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            } i == j i j {
                destroyed += destroy1(A, B, i);
                break;
            } destroyed += destroy1(A, B, i) destroyed destroy1(A, B, i) destroy1 A B i break; destroyed += destroy1(A, B, i) destroyed destroy1(A, B, i) destroy1 A B i destroyed += destroy2(A, B, j) destroyed destroy2(A, B, j) destroy2 A B j System.out.println(destroyed) System.out.println System.out System System.out destroyed String[] args args public static int destroy1(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i] < killable){
            destroyed += A[i];
            killable -= A[i];
            A[i] = 0;
            if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            }
        }else {
            destroyed += killable;
            A[i] -= killable;
        }

        return destroyed;
    } destroy1 {
        int destroyed = 0;

        int killable = B[i];
        if(A[i] < killable){
            destroyed += A[i];
            killable -= A[i];
            A[i] = 0;
            if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            }
        }else {
            destroyed += killable;
            A[i] -= killable;
        }

        return destroyed;
    } int destroyed = 0; destroyed 0 int killable = B[i]; killable B[i] B i if(A[i] < killable){
            destroyed += A[i];
            killable -= A[i];
            A[i] = 0;
            if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            }
        }else {
            destroyed += killable;
            A[i] -= killable;
        } A[i] < killable A[i] A i killable {
            destroyed += A[i];
            killable -= A[i];
            A[i] = 0;
            if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            }
        } destroyed += A[i] destroyed A[i] A i killable -= A[i] killable A[i] A i A[i] = 0 A[i] A i 0 if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            } A[i+1] < killable A[i+1] A i+1 i 1 killable {
                destroyed += A[i+1];
                A[i+1] = 0;
            } destroyed += A[i+1] destroyed A[i+1] A i+1 i 1 A[i+1] = 0 A[i+1] A i+1 i 1 0 {
                destroyed += killable;
                A[i+1] -= killable;
            } destroyed += killable destroyed killable A[i+1] -= killable A[i+1] A i+1 i 1 killable {
            destroyed += killable;
            A[i] -= killable;
        } destroyed += killable destroyed killable A[i] -= killable A[i] A i killable return destroyed; destroyed int[] A A int[] B B int i i public static int destroy2(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i+1] < killable){
            destroyed += A[i+1];
            killable -= A[i+1];
            A[i+1] = 0;
            if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            }
        }else {
            destroyed += killable;
            A[i+1] -= killable;
        }

        return destroyed;
    } destroy2 {
        int destroyed = 0;

        int killable = B[i];
        if(A[i+1] < killable){
            destroyed += A[i+1];
            killable -= A[i+1];
            A[i+1] = 0;
            if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            }
        }else {
            destroyed += killable;
            A[i+1] -= killable;
        }

        return destroyed;
    } int destroyed = 0; destroyed 0 int killable = B[i]; killable B[i] B i if(A[i+1] < killable){
            destroyed += A[i+1];
            killable -= A[i+1];
            A[i+1] = 0;
            if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            }
        }else {
            destroyed += killable;
            A[i+1] -= killable;
        } A[i+1] < killable A[i+1] A i+1 i 1 killable {
            destroyed += A[i+1];
            killable -= A[i+1];
            A[i+1] = 0;
            if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            }
        } destroyed += A[i+1] destroyed A[i+1] A i+1 i 1 killable -= A[i+1] killable A[i+1] A i+1 i 1 A[i+1] = 0 A[i+1] A i+1 i 1 0 if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            } A[i] < killable A[i] A i killable {
                destroyed += A[i];
                A[i] = 0;
            } destroyed += A[i] destroyed A[i] A i A[i] = 0 A[i] A i 0 {
                destroyed += killable;
                A[i] -= killable;
            } destroyed += killable destroyed killable A[i] -= killable A[i] A i killable {
            destroyed += killable;
            A[i+1] -= killable;
        } destroyed += killable destroyed killable A[i+1] -= killable A[i+1] A i+1 i 1 killable return destroyed; destroyed int[] A A int[] B B int i i public class Main {

    public static void main(String[] args) {
        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 destroyed = 0;

        for(int i=0; i<N; i++){
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        }

        System.out.println(destroyed);

    }

    public static int destroy1(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i] < killable){
            destroyed += A[i];
            killable -= A[i];
            A[i] = 0;
            if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            }
        }else {
            destroyed += killable;
            A[i] -= killable;
        }

        return destroyed;
    }

    public static int destroy2(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i+1] < killable){
            destroyed += A[i+1];
            killable -= A[i+1];
            A[i+1] = 0;
            if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            }
        }else {
            destroyed += killable;
            A[i+1] -= killable;
        }

        return destroyed;
    }
} public class Main {

    public static void main(String[] args) {
        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 destroyed = 0;

        for(int i=0; i<N; i++){
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        }

        System.out.println(destroyed);

    }

    public static int destroy1(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i] < killable){
            destroyed += A[i];
            killable -= A[i];
            A[i] = 0;
            if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            }
        }else {
            destroyed += killable;
            A[i] -= killable;
        }

        return destroyed;
    }

    public static int destroy2(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i+1] < killable){
            destroyed += A[i+1];
            killable -= A[i+1];
            A[i+1] = 0;
            if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            }
        }else {
            destroyed += killable;
            A[i+1] -= killable;
        }

        return destroyed;
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        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 destroyed = 0;

        for(int i=0; i<N; i++){
            int j = N-1 - i;

            if(i > j){
                break;
            }

            if(i == j){
                destroyed += destroy1(A, B, i);
                break;
            }

            destroyed += destroy1(A, B, i);
            destroyed += destroy2(A, B, j);
        }

        System.out.println(destroyed);

    }

    public static int destroy1(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i] < killable){
            destroyed += A[i];
            killable -= A[i];
            A[i] = 0;
            if(A[i+1] < killable){
                destroyed += A[i+1];
                A[i+1] = 0;
            }else{
                destroyed += killable;
                A[i+1] -= killable;
            }
        }else {
            destroyed += killable;
            A[i] -= killable;
        }

        return destroyed;
    }

    public static int destroy2(int[] A, int[] B, int i){
        int destroyed = 0;

        int killable = B[i];
        if(A[i+1] < killable){
            destroyed += A[i+1];
            killable -= A[i+1];
            A[i+1] = 0;
            if(A[i] < killable){
                destroyed += A[i];
                A[i] = 0;
            }else{
                destroyed += killable;
                A[i] -= killable;
            }
        }else {
            destroyed += killable;
            A[i+1] -= killable;
        }

        return destroyed;
    }
}