N = gets.chomp.to_i
A = gets.chomp.split.map(&:to_i)
B = gets.chomp.split.map(&:to_i)

total = A.inject(&:+)
# p A
# p B
# p total

0.upto(B.size - 1).each do |i|
  if B[i] > A[i]
    B[i] = B[i] - A[i]
    A[i] = 0
  else
    A[i] = A[i] - B[i]
    B[i] = 0
  end
  
  # Try A[i+1]
  if B[i] > A[i+1]
    B[i] = B[i] - A[i+1]
    A[i+1] = 0
  else
    A[i+1] = A[i+1] - B[i]
    B[i] = 0
  end
end

# For Debug
# p A
# p B

p total - A.inject(&:+)
