object Main extends App {
  import scala.util.control.Breaks

  val n = io.StdIn.readLine.toInt
  val a = io.StdIn.readLine.split(" ").map(_.toInt)
  val b = io.StdIn.readLine.split(" ").map(_.toInt)

  var s = 0

  for(i <- 0 to n - 1){
    var at_here
    var at_next

    if(a(i) >= b(i)){
      at_here = b(i)
      s += at_here
    }else{
      at_here = a(i)
      b(i) -= at_here
      if(a(i+1) >= b(i)){
        at_next = b(i)
      }else{
        at_next = a(i+1)
      }
      a(i+1) -= at_next
      s += at_here + at_next
    }
    /*
    if (a(i) >= b(i) ) {
      s += b(i)
    }else{
      s += a(i)
      b(i) -= a(i)
      if(a(i+1) < b(i)){
        s += a(i+1)
        a(i+1) = 0
      }else{
        s += b(i)
        a(i+1) -= b(i)
      }
    }
    */
  }
  println(s)
}
