'use strict'
function main(i) {
  i = i.trim().split('\n')
  const N = Number(i.shift())
  const A = i.shift().split(' ').map(n => Number(n))
  const B = i.shift().split(' ').map(n => Number(n))
  let ans = 0
  for (let i = 0; i < N; i++) {
    if (A[i] >= B[i]) {
      ans += B[i]
      A[i] -= B[i]
      B[i] = 0
    } else {
      ans += A[i]
      B[i] -= A[i]
      A[i] = 0
      if (A[i+1] >= B[i]) {
        ans += B[i]
        A[i+1] -= B[i]
        B[i] = 0
      } else {
        ans += A[i+1]
        B[i] -= A[i+1]
        A[i+1] = 0
      }
    } 
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
