function Main(input) {
  var N = parseInt(input.split("\n")[0]);
  var Alist = input.split("\n")[1].split(" ");
  var Blist = input.split("\n")[2].split(" ");
  
  for(var i = 0; i < Alist.length; i++){
    Alist[i] = parseInt(Alist[i]);
    if(i < Blist.length){
       Blist[i] = parseInt(Blist[i]);
    }
  }
  
  var output = 0;
  
  for(var i = 0; i < Blist.length; i++){
    var tmpA1 = Alist[i];
    var tmpA2 = Alist[i + 1];
    var tmpB = Blist[i];
    
    output += Math.min(tmpA1,tmpB);
    tmpB = tmpB - Math.min(tmpA1,tmpB);
    if(tmpB == 0){
       continue;
    }else{
      output += Math.min(tmpA2,tmpB);
      if(tmpA2 - tmpB > 0){
     	Alist[i + 1] = tmpA2 - tmpB;
      }else{
        Alist[i + 1] = 0;
      }
    }
  }
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
