n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
b = gets.chomp.split(" ").map(&:to_i)
count = 0

for i in 0..n-1
  #puts "a[i]#{a[i]} a[i+1]#{a[i+1]} b[i]#{b[i]}"
    if a[i]+a[i+1] > b[i]
        if a[i] > b[i]
            count += b[i]
            a[i] -= b[i]
            b[i] = 0
        else
            count += a[i] + ((b[i]-a[i]))
            a[i+1] -= b[i] - a[i]
            b[i] = b[i]-a[i] - (a[i+1]-b[i])
            a[i] = 0
        end
    else
        count += a[i] + a[i+1]
        a[i] = 0
        a[i+1] = 0
        b[i] -= b[i]-(a[i]+a[i+1])
    end
    # if i == n-1
    #     if a[i+1]>b[i]
    #         count += a[i+1] - b[i]
    #     else
    #         count += a[i+1]
    #     end
    # end
  #puts "count#{count}
end
puts count

