import scala.io.StdIn._

object Main extends App {

  
  val n = readInt()
  val abc = Array.fill(n)(readLine().split(" ").map(_.toInt))
  def solve() = {
    val dp = Array.fill(n+1)(Array.fill(3)(0))
    
    for {
      i <- 0 until n
      j <- 0 until 3
      k <- 0 until 3 if j != k
    } {
      dp(i+1)(k) = Math.max(dp(i)(j) + abc(i)(k), dp(i+1)(k))
    }
    
    (0 to 2).foldLeft(0) { (acc, i) => 
      Math.max(acc, dp(n)(i))
    }
  }

  println(solve())

}

