object Main extends App {

  def read() = {
    val n = scala.io.StdIn.readInt()
    val monstersArr = scala.io.StdIn.readLine().split(" ").map(_.toLong)
    val heroesArr = scala.io.StdIn.readLine().split(" ").map(_.toLong)
    (n, monstersArr, heroesArr)
  }


  def solve() = {
    val (n, monstersArr, heroesArr) = read()
    var defeatCount = 0L
    for(i <- 0 until heroesArr.length) {
      // City 1
      val tmpDefeat = Math.min(monstersArr(i), heroesArr(i))
      defeatCount += tmpDefeat
      // City 2
      val tmpDefeat2 = Math.min(monstersArr(i+1), heroesArr(i) - tmpDefeat)
      defeatCount += tmpDefeat2
      monstersArr(i+1) -= tmpDefeat2
    }
    defeatCount
  }

  println(solve)

}