n=io.read("*n")
a={}
b={}

for i=1,n+1 do
  table.insert(a,io.read("*n"))
end

for i=1,n do
  table.insert(b,io.read("*n"))
end

ans=0
for i=1,n do
  if a[i]<b[i] then
    local j=i
    if a[j]<=b[i] and a[j]~=0 then
      b[i]=b[i]-a[j]
      ans=ans+a[j]
      a[j]=0
    else
      if a[j]~=0 then
        a[j]=a[j]-b[i]
        ans=ans+b[i]
        b[i]=0
      end
    end

    if a[j+1]<=b[i] and a[j+1]~=0 then
      b[i]=b[i]-a[j+1]
      ans=ans+a[j+1]
      a[j+1]=0
    else
      if a[j+1]~=0 then
        a[j+1]=a[j+1]-b[i]
        ans=ans+b[i]
        b[i]=0
      end
    end
  else
    a[i]=a[i]-b[i]
    ans=ans+b[i]
    b[i]=0
  end
end

print(ans)