local N = io.read("n")
local A = {} for i=1,N+1 do A[i] = io.read("n") end
local B = {} for i=1,N do B[i] = io.read("n") end
B[N+1]=0
local count = 0
local prev_power = 0
for i=1,N+1 do
  local mon = A[i]
  if mon <= prev_power then
    count = count + mon
    mon = 0
  else
    count = count + prev_power
    mon = mon - prev_power
  end
  local power = B[i]
  if mon <= power then
    prev_power = power - mon
    count = count + mon
  else
    prev_power = 0
    count = count + power
  end
end
print(count)