num = gets.to_i
line1 = gets.split.map(&:to_i)
line2 = gets.split.map(&:to_i)
ans = 0
num.times do |i|
	if line1[i] > line2[i] or line1[1] == line2[i]
		ans += line2[i]
	else
		ans += line1[i]
		line2[i] -= line1[i]
		if line2[i] < line1[i+1] or line2[i] == line1[i+1]
			ans += line2[i]
			line1[i+1] -= line2[i]
		else
			ans += line1[i+1]
			line1[i+1] = 0
		end
	end
end

p ans