n = gets.to_i
m = gets.split(" ").map(&:to_i)
h = gets.split(" ").map(&:to_i)

t = 0

n.times do |i|
  if m[i] <= h[i]
    t += m[i]
    h[i] -= m[i]
    if m[i + 1] <= h[i]
      t += m[i + 1]
      m[i + 1] = 0
    else
      t += h[i]
      m[i + 1] -= h[i]
      h[i] = 0
    end
  else
    t += h[i]
  end
end

puts t