import scala.io.StdIn._
object Main extends App {
  readInt
  val as = readLine.split(" ").map(_.toInt)
  val bs = 0 +: readLine.split(" ").map(_.toInt)

  val (_, sum) = as.zip(bs).foldRight((0, 0)){case ((a, b), (pre, sum)) =>
    if (a < pre) (b, sum + a)
    else if (a - pre < b) (b - (a - pre), sum + a)
    else (0, sum + pre + b)
  }

  println(sum)
}