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 beat_ii = min(monsters(0), savers(0))
  var beat_ij = min(monsters(1), savers(0)-beat_ii)
  var sum = beat_ii+beat_ij
  (1 to n-1).foreach{i =>
      beat_ii = min(monsters(i)-beat_ij, savers(i))
      beat_ij = min(monsters(i+1), savers(i)-beat_ii)
      sum += beat_ii+beat_ij
  }
  println(sum)
}