
object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  val monsters = readLine().trim.split(' ').map(_.toInt)
  val heros = readLine().trim.split(' ').map(_.toInt)
  var result = 0L
  for (i <- heros.indices) {
    val a = math.min(heros(i), monsters(i))
    val b = math.min(heros(i) - a, monsters(i + 1))
    result += a + b
    monsters(i + 1) -= b
  }
  println(result)
}