object Main {

  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readLine.toInt
    val aList = io.StdIn.readLine.split(" ").map(_.toInt).toList
    val bList = io.StdIn.readLine.split(" ").map(_.toInt).toList

    def solve(aList: List[Int], bList: List[Int]): Int = {

      val ans = aList.tail.zip(bList).foldLeft((0L, aList.head)) {
        case (a, b) =>
          println(a, b)
          val x = Math.min(a._2 + b._1, b._2)
          (x + a._1, Math.min(a._2 + b._1 - x, b._1))
      }._1

      ans.toInt
    }

    println(solve(aList, bList))
  }

}