n = gets.chomp.to_i
citys = gets.chomp.split.map(&:to_i)
braves = gets.chomp.split.map(&:to_i)
monster = 0
braves.each_with_index do |brave, i|
  if citys[i] > brave
    monster += brave
  else
    monster += citys[i]
    add_monster = [brave -citys[i], citys[i+1]].min
    monster += add_monster
    citys[i+1] -= add_monster
  end
end

print("#{monster}\n")