import scala.collection.mutable.ArrayBuffer

object Main{

  def main(args: Array[String]): Unit = {
    var len = readInt
    var A:ArrayBuffer[Int]= ArrayBuffer()
    var B:ArrayBuffer[Int]= ArrayBuffer()
    for(i <- 0 until len){
      var temp = readLine.split(" ").map(x => x.toInt)
      A = A:+temp(0)
      B = B :+ temp(0)
    }

    var positive = 0
    var negative = 0

    for(i <- 0 until len-1){
      positive += scala.math.min(A(i),B(i+1))
    }
    positive += scala.math.min(A(len-1),B(0))

    for(i <- 0 until len-1){
      negative += scala.math.min(B(i),A(i+1))
    }
      negative += scala.math.min(B(len-1),A(0))

    println(scala.math.min(positive,negative))
  }
}