require 'pp'
require 'set'

n = gets.chomp!.to_i
a_n = gets.chomp!.split(" ").map(&:to_i)
b_n = gets.chomp!.split(" ").map(&:to_i)

count = 0
n.times do |i|
    if b_n[i] >= a_n[i]
        tmp = a_n[i]
        count += tmp
        a_n[i] = 0
        b_n[i] -= tmp
    else
        tmp = b_n[i]
        count += b_n[i]
        b_n[i] = 0
        a_n[i] -= tmp
    end

    if b_n[i] > 0
        if b_n[i] >= a_n[i+1] 
            tmp = a_n[i+1]
            count += tmp
            a_n[i+1] = 0
            b_n[i] -= tmp
        else
            tmp = b_n[i]
            count += b_n[i]
            b_n[i] = 0
            a_n[i+1] -= tmp
        end
    end

    #pp a_n
    #pp b_n
end

#pp a_n
#pp b_n
puts count
