object Main extends App {
  def min(ls: Int*): Int = ls.min
  
  val n = readInt
  val monsters = readLine.split(" ").map(_.toInt)
  val savers = readLine.split(" ").map(_.toInt)
  var fii = scala.collection.mutable.ArrayBuffer[Int]()
  var fij = scala.collection.mutable.ArrayBuffer[Int]()
  
  fii += min(monsters(0), savers(0))
  fij += min(monsters(1), savers(0)-fii.last)
  Range(1,n).foreach{i =>
    fii += min(monsters(i)-fij.last, savers(i))
    fij += min(monsters(i+1), savers(i)-fii.last)
  }
  
  print(fii.foldLeft(0L)(_+_) + fij.foldLeft(0L)(_+_))
}