fun main(args : Array<String>) {
    val n = readLine()!!.toInt()

    val aa = mutableListOf<Int>()
    val bb = mutableListOf<Int>()
    val cc = mutableListOf<Int>()

    repeat(n) {
        val (a, b, c) = readLine()!!.split(" ").map { it.toInt() }
        aa.add(a)
        bb.add(b)
        cc.add(c)
    }

    val dp = Array(n+1) { IntArray(3) {0} }

    for (i in 1..n) {
        dp[i][Activities.A] = Math.max(dp[i-1][Activities.B], dp[i-1][Activities.C]) + aa[i-1]
        dp[i][Activities.B] = Math.max(dp[i-1][Activities.A], dp[i-1][Activities.C]) + bb[i-1]
        dp[i][Activities.C] = Math.max(dp[i-1][Activities.A], dp[i-1][Activities.B]) + cc[i-1]
    }

    println(listOf(dp[n][Activities.A], dp[n][Activities.B], dp[n][Activities.C]).max())
}

object Activities {
    const val A = 0
    const val B = 1
    const val C = 2
}