function Main(input) {
  input = input.split('\n')
  var N = parseInt(input[0])
  var A = input[1].split(' ').map(str => parseInt(str))
  var B = input[2].split(' ').map(str => parseInt(str))
  var allMonster = A.reduce((prev, current) => prev + current)

  for (var i = 0; i < N; i++) {
    if (A[i] <= B[i]) {
      B[i] -= A[i]
      A[i] = 0
      if (A[i + 1] <= B[i]) {
        A[i + 1] = 0
      } else {
        A[i + 1] -= B[i]
      }
    } else {
      A[i] -= B[i]
    }
  }

  var remainMonster = A.reduce((prev, current) => prev + current)
  console.log(allMonster - remainMonster)
}

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