n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)

ans = 0
n.times do |i|
  ans += [a[i], b[i]].min
  if b[i] > a[i]
    ans += [a[i+1], b[i]-a[i]].min
    a[i+1] -= [a[i+1], b[i]-a[i]].min
  end
end

puts ans