N = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)

ans = 0
N.times do |i|
  c = [a[i], b[i]].min
  ans += c
  a[i] -= c
  b[i] -= c

  c2 = [a[i+1], b[i]].min
  ans += c2
  a[i+1] -= c2
  b[i] -= c2
end

p ans
