N = gets.chomp.to_i
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
score = 0
old = 0

0.upto(N) do |i|
  enemy = A[i]
  hero = B[i] || 0

  if enemy <= old
    score += enemy
    old = hero
    next
  else
    enemy -= old
    score += old
  end

  if enemy <= hero
    score += enemy
    old = hero - enemy
  else
    score += hero
    old = 0
  end
end

puts score