n = gets.chomp.to_i
alist = gets.chomp.split.collect{ |item| item.to_i}
blist = gets.chomp.split.collect{ |item| item.to_i}

max = 0

if blist[0] >=  alist[0]
  max += alist[0]
  blist[0] -= alist[0]
  alist[0] = 0
else#blist[0] < alist[0]
  max += blist[0]
  alist[0] -= blist[0]
  blist[0] = 0
end

1.upto(n) do |i|
  if blist[i-1] >= alist[i]
    max += alist[i]
    blist[i-1] -= alist[i]
    alist[i] = 0
    next
  else
    max += blist[i-1]
    alist[i] -= blist[i-1]
    blist[i-1] = 0
  end
  break if (i==n)
  if blist[i] >= alist[i]
    max += alist[i]
    blist[i] -= alist[i]
    alist[i] = 0
  else
    max += blist[i]
    alist[i] -= blist[i]
    blist[i] = 0
  end
end

puts max
