# coding: utf-8
n = gets().to_i
a = gets.split(' ').map do |e|
  e.to_i
end
b = gets.split(' ').map do |e|
  e.to_i
end

ans = 0
b.each_with_index do |e, i|
  # 左から全力で倒す
  left = [a[i], b[i]].min
  ans += left
  a[i] -= left
  b[i] -= left

  # 残った戦力で右を全力で倒す
  right = [a[i + 1], b[i]].min
  ans += right
  a[i + 1] -= right
end
puts ans

