n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
i = n - 1

ans = 0

n.times do
  
  if b[i] > a[i+1]
    ans += a[i+1]
    b[i] = b[i] - a[i+1]
    a[i+1] = 0
  else
    ans += b[i]
    a[i+1] = a[i+1] - b[i]
    b[i] = 0
  end
  
  if  b[i] > a[i]
      ans += a[i]
      a[i] = 0
  else
    ans += b[i]
    a[i] = a[i] - b[i]
  end  
  
  i = i - 1
end

puts ans