counter=0
n=gets.to_i
monster=gets.chomp.split.map(&:to_i)
brave=gets.chomp.split.map(&:to_i)
n.times do|x|
  defeated = [monster[x],brave[x]].min
  counter= counter+defeated
  rest_brave=brave[x]-defeated
  next_defeated = [monster[x+1],rest_brave].min
  counter= counter+next_defeated
  monster[x+1]=monster[x+1]-next_defeated
end  
puts counter