object Main {
  def main(args:Array[String]) {
    val N = readLine().toInt
    val A = readLine().split(' ').map(_.toInt)
    val B = readLine().split(' ').map(_.toInt)

    var count = 0l
    for(i <- 0 until N) {
      if(A(i) <= B(i)) {
        count += A(i)
        B(i) -= A(i)
      }else if(A(i) > B(i)) {
        count += B(i)
        B(i) = 0
      }
      if(A(i + 1) <= B(i)){
        count += A(i + 1)
        A(i + 1) = 0
      }else if(A(i + 1) > B(i)) {
        count += B(i)
        A(i + 1) -= B(i)
      }
    }
    println(count)
  }
}
