import java.util.*

fun main(args: Array<String>) {

    val sc = Scanner(System.`in`)
    val N = sc.nextInt()

    data class abc(val a:Long, val b:Long, val c:Long) {
        fun max() = Math.max(Math.max(a,b),c)
    }

    val DP = Array(N){abc(0L,0L,0L)}//abcを選んだ時の最大幸福度
    val a = sc.nextLong()
    val b = sc.nextLong()
    val c = sc.nextLong()
    DP[0] = abc(a,b,c)
    for (i in 1 until N) {
        val a = sc.nextLong() + Math.max(DP[i-1].b, DP[i-1].c)
        val b = sc.nextLong() + Math.max(DP[i-1].c, DP[i-1].a)
        val c = sc.nextLong() + Math.max(DP[i-1].a, DP[i-1].b)

        DP[i] = abc(a,b,c)
    }
    //for ((n,h) in DP) print("$n ")
    println(DP[N-1].max())
}