object Main{
  def main(args: Array[String]) : Unit = {
    System.err.println("ok")
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val happy = 
      (1 to n).map{
        _ => (sc.nextInt,sc.nextInt,sc.nextInt)
      }


    val fin = happy.foldLeft((0,0,0)) { (acc, h) =>
      (
        Math.max(acc._2,acc._3) + h._1,
        Math.max(acc._1,acc._3) + h._2,
        Math.max(acc._1,acc._2) + h._3
      )  
    }
    println(Seq(fin._1,fin._2,fin._3).max)
  }
}

