import java.util.Scanner;

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 < A.length; i++) {
      A[i] = sc.nextInt();
    }
    for (int i = 0; i < B.length; i++) {
      B[i] = sc.nextInt();
    }

    long ans = 0;
//    for (int i = 0; i < N; i++) {
//      int life = B[i] - A[i];
//      if (life >= 0) {
//        ans += A[i];
//        if (A[i + 1] >= life) {
//          ans += life;
//          A[i + 1] -= life;
//        } else {
//          ans += A[i + 1];
//          A[i + 1] = 0;
//        }
//      } else {
//        ans += B[i];
//      }
//    }

    for (int i = 0; i < N; i++) {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    }
    System.out.println(ans);
  }
} import java.util.Scanner; Scanner 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 < A.length; i++) {
      A[i] = sc.nextInt();
    }
    for (int i = 0; i < B.length; i++) {
      B[i] = sc.nextInt();
    }

    long ans = 0;
//    for (int i = 0; i < N; i++) {
//      int life = B[i] - A[i];
//      if (life >= 0) {
//        ans += A[i];
//        if (A[i + 1] >= life) {
//          ans += life;
//          A[i + 1] -= life;
//        } else {
//          ans += A[i + 1];
//          A[i + 1] = 0;
//        }
//      } else {
//        ans += B[i];
//      }
//    }

    for (int i = 0; i < N; i++) {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    }
    System.out.println(ans);
  }
} 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 < A.length; i++) {
      A[i] = sc.nextInt();
    }
    for (int i = 0; i < B.length; i++) {
      B[i] = sc.nextInt();
    }

    long ans = 0;
//    for (int i = 0; i < N; i++) {
//      int life = B[i] - A[i];
//      if (life >= 0) {
//        ans += A[i];
//        if (A[i + 1] >= life) {
//          ans += life;
//          A[i + 1] -= life;
//        } else {
//          ans += A[i + 1];
//          A[i + 1] = 0;
//        }
//      } else {
//        ans += B[i];
//      }
//    }

    for (int i = 0; i < N; i++) {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    }
    System.out.println(ans);
  } 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 < A.length; i++) {
      A[i] = sc.nextInt();
    }
    for (int i = 0; i < B.length; i++) {
      B[i] = sc.nextInt();
    }

    long ans = 0;
//    for (int i = 0; i < N; i++) {
//      int life = B[i] - A[i];
//      if (life >= 0) {
//        ans += A[i];
//        if (A[i + 1] >= life) {
//          ans += life;
//          A[i + 1] -= life;
//        } else {
//          ans += A[i + 1];
//          A[i + 1] = 0;
//        }
//      } else {
//        ans += B[i];
//      }
//    }

    for (int i = 0; i < N; i++) {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    }
    System.out.println(ans);
  } 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 < A.length; i++) {
      A[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length 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 < B.length; i++) {
      B[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < B.length i B.length B B.length 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 ans = 0; ans 0 for (int i = 0; i < N; i++) {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    } {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    } if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      } B[i] > A[i] B[i] B i A[i] A i {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } B[i] -= A[i] B[i] B i A[i] A i ans += A[i] ans A[i] A i ans += Math.min(A[i+1], B[i]) ans Math.min(A[i+1], B[i]) Math.min Math A[i+1] A i+1 i 1 B[i] B i A[i+1] -= Math.min(A[i+1], B[i]) A[i+1] A i+1 i 1 Math.min(A[i+1], B[i]) Math.min Math A[i+1] A i+1 i 1 B[i] B i {
        ans += B[i];
      } ans += B[i] ans B[i] B i System.out.println(ans) System.out.println System.out System System.out ans String[] args args 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 < A.length; i++) {
      A[i] = sc.nextInt();
    }
    for (int i = 0; i < B.length; i++) {
      B[i] = sc.nextInt();
    }

    long ans = 0;
//    for (int i = 0; i < N; i++) {
//      int life = B[i] - A[i];
//      if (life >= 0) {
//        ans += A[i];
//        if (A[i + 1] >= life) {
//          ans += life;
//          A[i + 1] -= life;
//        } else {
//          ans += A[i + 1];
//          A[i + 1] = 0;
//        }
//      } else {
//        ans += B[i];
//      }
//    }

    for (int i = 0; i < N; i++) {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    }
    System.out.println(ans);
  }
} 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 < A.length; i++) {
      A[i] = sc.nextInt();
    }
    for (int i = 0; i < B.length; i++) {
      B[i] = sc.nextInt();
    }

    long ans = 0;
//    for (int i = 0; i < N; i++) {
//      int life = B[i] - A[i];
//      if (life >= 0) {
//        ans += A[i];
//        if (A[i + 1] >= life) {
//          ans += life;
//          A[i + 1] -= life;
//        } else {
//          ans += A[i + 1];
//          A[i + 1] = 0;
//        }
//      } else {
//        ans += B[i];
//      }
//    }

    for (int i = 0; i < N; i++) {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    }
    System.out.println(ans);
  }
} Main
import java.util.Scanner;

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 < A.length; i++) {
      A[i] = sc.nextInt();
    }
    for (int i = 0; i < B.length; i++) {
      B[i] = sc.nextInt();
    }

    long ans = 0;
//    for (int i = 0; i < N; i++) {
//      int life = B[i] - A[i];
//      if (life >= 0) {
//        ans += A[i];
//        if (A[i + 1] >= life) {
//          ans += life;
//          A[i + 1] -= life;
//        } else {
//          ans += A[i + 1];
//          A[i + 1] = 0;
//        }
//      } else {
//        ans += B[i];
//      }
//    }

    for (int i = 0; i < N; i++) {
      if (B[i] > A[i]) {
        B[i] -= A[i];
        ans += A[i];
        ans += Math.min(A[i+1], B[i]);
        A[i+1] -= Math.min(A[i+1], B[i]);
      } else {
        ans += B[i];
      }
    }
    System.out.println(ans);
  }
}