import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

fun main() {
  val INF = 1000000001
  val n = readLine()!!.toInt()
  val activities = Array(n){
    val (a,b,c) = readLine()!!.split(' ').map { it.toInt() }
    Triple(a,b,c)
  }

  val dp = Array<IntArray>(n){ intArrayOf(0,0,0)}
  dp[0][0] = activities[0].first
  dp[0][1] = activities[0].second
  dp[0][2] = activities[0].third

  for (i in 1 until n){
    dp[i][0] = max(dp[i][0], max(dp[i-1][1], dp[i-1][2]) + activities[i].first)
    dp[i][1] = max(dp[i][1], max(dp[i-1][0], dp[i-1][2]) + activities[i].second)
    dp[i][2] = max(dp[i][2], max(dp[i-1][1], dp[i-1][0]) + activities[i].third)
  }

  println(max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])))
}