function main(input){
  input = input.split("\n");
  const n = parseInt(input[0]);
  var a = input[1].split(" ").map(x => parseInt(x))
  var b = input[2].split(" ").map(x => parseInt(x))
  var cnt = 0;
//  console.log(n);


  
  for (var i = 0; i < n; i++) {
    // a[i]とb[i]の比較
    if (a[i] > b[i]) {
      cnt += b[i];
      a[i] -= b[i];
      b[i] = 0;      
    }else {
      cnt += a[i];
      b[i] -= a[i];
      a[i] = 0;
    }

    // a[i+1]とb[i]の比較
    if (a[i+1] > b[i]) {
      cnt += b[i];
      a[i+1] -= b[i];
      b[i] = 0;      
    }else {
      cnt += a[i+1];
      b[i] -= a[i+1];
      a[i+1] = 0;
    }
    
  }
  
//  console.log(a);
// console.log(b);

  console.log(cnt);

}
  
main(require('fs').readFileSync('/dev/stdin', 'utf8'));