'use strict';(function(input){
  
  input=input.trim().split(/\s+/).map(x=>x-0);
  const N =input[0],
        A=input.slice(1,N+2),
        B=input.slice(N+2);
  var ans=0;
  for(let i=0;i<N;i++){
    let a=A[i],a_=A[i+1],b=B[i], c,d;
    A[i]-=(c=Math.min(a,b));
    B[i]-=c;
    ans+=c;
    A[i+1]-=(d=Math.min(a_,Math.max(b-a,0)));
    B[i]-=d;
    ans+=d;
    //console.log(a,b,c,d,ans);
  }
  ans+=Math.min(A[N],B[N-1])
  console.log(ans);
})(require('fs').readFileSync('/dev/stdin','utf8'));
