import scala.io.StdIn._
object Main extends App {
  val n = readInt
  val abc = (1 to n)
    .map { _ =>
      readLine.split(" ").map(_.toInt)
    }
  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)(j) = math.max(dp(i + 1)(j), dp(i)(k) + abc(i)(j))
  }

  println(dp(n).max)
}
