import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[] a = new int[N + 1];
    int[] b = new int[N];
    for (int i = 0; i < N + 1; i++) a[i] = scanner.nextInt();
    for (int i = 0; i < N; i++) b[i] = scanner.nextInt();

    long count = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    }
    System.out.println(count);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] a = new int[N + 1];
    int[] b = new int[N];
    for (int i = 0; i < N + 1; i++) a[i] = scanner.nextInt();
    for (int i = 0; i < N; i++) b[i] = scanner.nextInt();

    long count = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    }
    System.out.println(count);
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] a = new int[N + 1];
    int[] b = new int[N];
    for (int i = 0; i < N + 1; i++) a[i] = scanner.nextInt();
    for (int i = 0; i < N; i++) b[i] = scanner.nextInt();

    long count = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    }
    System.out.println(count);
  } main {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] a = new int[N + 1];
    int[] b = new int[N];
    for (int i = 0; i < N + 1; i++) a[i] = scanner.nextInt();
    for (int i = 0; i < N; i++) b[i] = scanner.nextInt();

    long count = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    }
    System.out.println(count);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner 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] = scanner.nextInt(); int i = 0; int i = 0; i 0 i < N + 1 i N + 1 N 1 i++ i++ i a[i] = scanner.nextInt(); a[i] = scanner.nextInt() a[i] a i scanner.nextInt() scanner.nextInt scanner for (int i = 0; i < N; i++) b[i] = scanner.nextInt(); int i = 0; int i = 0; i 0 i < N i N i++ i++ i b[i] = scanner.nextInt(); b[i] = scanner.nextInt() b[i] b i scanner.nextInt() scanner.nextInt scanner long count = 0; count 0 for (int i = 0; i < N; i++) {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    } {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    } for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      } int j = 0; int j = 0; j 0 j < 2 j 2 j++ j++ j {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      } {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      } int beat = Math.min(a[i + j], b[i]); beat Math.min(a[i + j], b[i]) Math.min Math a[i + j] a i + j i j b[i] b i count += beat count beat a[i + j] -= beat a[i + j] a i + j i j beat b[i] -= beat b[i] b i beat System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] a = new int[N + 1];
    int[] b = new int[N];
    for (int i = 0; i < N + 1; i++) a[i] = scanner.nextInt();
    for (int i = 0; i < N; i++) b[i] = scanner.nextInt();

    long count = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    }
    System.out.println(count);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] a = new int[N + 1];
    int[] b = new int[N];
    for (int i = 0; i < N + 1; i++) a[i] = scanner.nextInt();
    for (int i = 0; i < N; i++) b[i] = scanner.nextInt();

    long count = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    }
    System.out.println(count);
  }
} Main
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[] a = new int[N + 1];
    int[] b = new int[N];
    for (int i = 0; i < N + 1; i++) a[i] = scanner.nextInt();
    for (int i = 0; i < N; i++) b[i] = scanner.nextInt();

    long count = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 2; j++) {
        int beat = Math.min(a[i + j], b[i]);
        count += beat;
        a[i + j] -= beat;
        b[i] -= beat;
      }
    }
    System.out.println(count);
  }
}
