n=io.read("*n","*l")
a={}
b={}
for i=1,n+1 do
    a[i]=io.read("*n")
end
for i=1,n do
    b[i]=io.read("*n")
end

counter=0
for i=1,n do
    
    if a[i]<b[i] then
        counter=counter+a[i]
        b[i]=b[i]-a[i]
    else
        counter=counter+b[i]
        b[i]=0
    end

    if a[i+1]<b[i] then
        counter=counter+a[i+1]
        a[i+1]=0
    else
        counter=counter+b[i]
        a[i+1]=a[i+1]-b[i]
    end
    
end

print(counter)