import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
  std.functional, std.container, std.typecons;

void main() {
  auto N = readln.split[0].to!int;
  auto A = readln.split.to!(int[]);
  auto B = readln.split.to!(int[]);

  ulong ans = 0;
  foreach(i; 0..N) {
    int b = B[i];
    int x;
    x = min(A[i], b);
    ans += x;
    A[i] -= x;
    b-= x;
    
    x = min(A[i+1], b);
    ans += x;
    A[i+1] -= x;
    b -= x;
  }
  ans.writeln;
}
