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

max = 0

(0..(n-1)).each do |i|
  if b[i] >= a[i] + a[i+1]
    max += a[i] + a[i+1]
    a[i+1] = 0
  elsif b[i] > a[i]
    max += b[i]
    a[i+1] = a[i+1] - (b[i] - a[i])
  else
    max += b[i]
  end
end
puts max