'use strict';
function main(input) {
  const args = input.split('\n'),
        N = parseInt(args[0]),
        A = args[1].split(' '),
        B = args[2].split(' ');
  let cnt = 0;
  for (let i = 0; i < N; ++i) {
    let a = parseInt(A[i]), aNext = parseInt(A[i+1]),
        b = parseInt(B[i]), difference = b-a;
    if (difference > 0) {
      cnt += a;
      let differenceNew = aNext - difference;
      if (differenceNew > 0) {
        cnt += difference;
        A[i+1] = differenceNew.toString();
      } else {
        cnt += aNext;
        A[i+1] = '0';
      }
    } else {
      cnt += b;
    }
  }
  console.log(cnt);
}

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