import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 15:06-

            int n = sc.nextInt();
            int[] as = new int[n + 1];
            for (int i = 0; i < as.length; i++) as[i] = sc.nextInt();

            int[] vs = new int[n];
            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            long killed = 0;
            for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            }
            
            out.println(killed);
        }
    }

} import java.io.BufferedInputStream; BufferedInputStream java.io import java.io.BufferedOutputStream; BufferedOutputStream 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) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 15:06-

            int n = sc.nextInt();
            int[] as = new int[n + 1];
            for (int i = 0; i < as.length; i++) as[i] = sc.nextInt();

            int[] vs = new int[n];
            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            long killed = 0;
            for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            }
            
            out.println(killed);
        }
    }

} Main public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 15:06-

            int n = sc.nextInt();
            int[] as = new int[n + 1];
            for (int i = 0; i < as.length; i++) as[i] = sc.nextInt();

            int[] vs = new int[n];
            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            long killed = 0;
            for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            }
            
            out.println(killed);
        }
    } main {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 15:06-

            int n = sc.nextInt();
            int[] as = new int[n + 1];
            for (int i = 0; i < as.length; i++) as[i] = sc.nextInt();

            int[] vs = new int[n];
            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            long killed = 0;
            for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            }
            
            out.println(killed);
        }
    } try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 15:06-

            int n = sc.nextInt();
            int[] as = new int[n + 1];
            for (int i = 0; i < as.length; i++) as[i] = sc.nextInt();

            int[] vs = new int[n];
            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            long killed = 0;
            for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            }
            
            out.println(killed);
        } {

            Scanner sc = new Scanner(in);

            // 15:06-

            int n = sc.nextInt();
            int[] as = new int[n + 1];
            for (int i = 0; i < as.length; i++) as[i] = sc.nextInt();

            int[] vs = new int[n];
            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            long killed = 0;
            for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            }
            
            out.println(killed);
        } BufferedInputStream in = new BufferedInputStream(System.in) BufferedInputStream in = new BufferedInputStream(System.in) new BufferedInputStream(System.in) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) new PrintWriter(new BufferedOutputStream(System.out)) Scanner sc = new Scanner(in); sc new Scanner(in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] as = new int[n + 1]; as new int[n + 1] n + 1 n 1 for (int i = 0; i < as.length; i++) as[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < as.length i as.length as as.length i++ i++ i as[i] = sc.nextInt(); as[i] = sc.nextInt() as[i] as i sc.nextInt() sc.nextInt sc int[] vs = new int[n]; vs new int[n] n for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < vs.length i vs.length vs vs.length i++ i++ i vs[i] = sc.nextInt(); vs[i] = sc.nextInt() vs[i] vs i sc.nextInt() sc.nextInt sc long killed = 0; killed 0 for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            } int i = vs.length - 1; int i = vs.length - 1; i vs.length - 1 vs.length vs vs.length 1 i >= 0 i 0 i-- i-- i {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            } {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            } for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                } int j = 1; int j = 1; j 1 j >= 0 j 0 j-- j-- j {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                } {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                } int a = as[i + j]; a as[i + j] as i + j i j int v = vs[i]; v vs[i] vs i int m = Math.min(v, a); m Math.min(v, a) Math.min Math v a killed += m killed m vs[i] -= m vs[i] vs i m as[i + j] -= m as[i + j] as i + j i j m out.println(killed) out.println out killed String[] args args public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 15:06-

            int n = sc.nextInt();
            int[] as = new int[n + 1];
            for (int i = 0; i < as.length; i++) as[i] = sc.nextInt();

            int[] vs = new int[n];
            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            long killed = 0;
            for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            }
            
            out.println(killed);
        }
    }

} public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 15:06-

            int n = sc.nextInt();
            int[] as = new int[n + 1];
            for (int i = 0; i < as.length; i++) as[i] = sc.nextInt();

            int[] vs = new int[n];
            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            long killed = 0;
            for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            }
            
            out.println(killed);
        }
    }

} Main
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 15:06-

            int n = sc.nextInt();
            int[] as = new int[n + 1];
            for (int i = 0; i < as.length; i++) as[i] = sc.nextInt();

            int[] vs = new int[n];
            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            long killed = 0;
            for (int i = vs.length - 1; i >= 0; i--) {
                for (int j = 1; j >= 0; j--) {
                    int a = as[i + j];
                    int v = vs[i];

                    int m = Math.min(v, a);
                    killed += m;
                    vs[i] -= m;
                    as[i + j] -= m;
                }
            }
            
            out.println(killed);
        }
    }

}
