import kotlin.math.*

fun main() {
  val reader = System.`in`.bufferedReader()
  val N = Integer.parseInt(reader.readLine())
  val abc = List(N, {
    reader.readLine().split(" ").map(Integer::parseInt)
  })

  if (N == 1) {
    println(abc[0].max())
    return
  }

  var dp = Array(N, {
    IntArray(3, { 0 })
  })

  val IA = 0
  val IB = 1
  val IC = 2
  
  dp[0][IA] = abc[0][IA]
  dp[0][IB] = abc[0][IB]
  dp[0][IC] = abc[0][IC]

  for (n in 1..N-1) {
    dp[n][IA] = max(dp[n-1][IB], dp[n-1][IC]) + abc[n][IA]
    dp[n][IB] = max(dp[n-1][IA], dp[n-1][IC]) + abc[n][IB]
    dp[n][IC] = max(dp[n-1][IA], dp[n-1][IB]) + abc[n][IC]
  }

  val ans = max(dp[N-1][IA], max(dp[N-1][IB], dp[N-1][IC]))
  println(ans)
}