N = gets.to_i
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
ans = 0
N.times do |i|
  if A[i] >= B[i]
    ans += B[i]
  else
    ans += A[i]
    B[i] -= A[i]
    if A[i + 1] >= B[i]
      ans += B[i]
      A[i + 1] -= B[i]
    else
      ans += A[i + 1]
      A[i + 1] = 0
    end
  end
end
puts ans