N = gets.to_i
A = gets.split.map &:to_i
B = gets.split.map &:to_i

aa = A.dup
N.times{|i|
  b = B[i]
  sub_0 = [aa[i], b].min
  aa[i] -= sub_0
  b -= sub_0
  sub_1 = [aa[i+1], b].min
  aa[i+1] -= sub_1
}
p A.inject(:+) - aa.inject(:+)