object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  var a = readLine().split(" ").map(_.toInt)
  var b = readLine().split(" ").map(_.toInt)
  val aAll = a.sum
  var an = new Array[Int](n + 1)
  for(i <- (0 until(n))){
    if(b(i) >= a(i)){
      b(i) = b(i) - a(i)
      a(i) = 0
      if(a(i + 1) >= b(i)){
        a(i+1) -= b(i)
      }else{
        a(i+1) = 0
      }
    }else{
      a(i) -= b(i)
      b(i) = 0
    }
  }
  println(aAll - a.sum)
}