n = gets.to_i + 1
mons = []
brvs = []
mons = gets.split.map(&:to_i)
brvs = gets.split.map(&:to_i)
res = 0
i = 0
while i < n
  if i < n - 1
    res += brvs[i] if mons[i] + mons[i + 1] > brvs[i]
  end
  i += 1
end

puts res