n = gets.to_i
a = gets.strip.split.map(&:to_i)
b = gets.strip.split.map(&:to_i)
sum = 0
i = 0
s = b[0]
nokori = 0
while i<n-1 do
  if a[i]>=s
    sum += s
    s = b[i+1]
  else
    sum += a[i]
    s = b[i+1]+(s-a[i])
  end
  i += 1
end
sum += [s,a[n-1]+a[n]].min
puts sum