import io.StdIn._
import math._

object Main extends App {
  val n = readInt()
  val abcs = for (_ <- 1 to n) yield readLine() split(' ') map(_.toInt)

  val dp = Array.ofDim[Int](n, 3)
  dp(0) = abcs.head

  val combi = Seq((0,1), (0,2), (1,0), (1,2), (2,0), (2,1))

  for (i <- 1 until n) {
    val prev = dp(i-1)
    val just = abcs(i)
    dp(i)(0) = max(just(0)+prev(1), just(0)+prev(2))
    dp(i)(1) = max(just(1)+prev(0), just(1)+prev(2))
    dp(i)(2) = max(just(2)+prev(0), just(2)+prev(1))
  }

  println(dp.last.max)
}