private fun readInts() = readLine()!!.split(" ").map(String::toInt)

fun main(args: Array<out String>) {
    val (N) = readInts()
    val abc = (0 until N).map { readInts() }

    val happiness = Array(N) { Array(3) { 0 } }
    (0 until 3).forEach { happiness[0][it] = abc[0][it] }

    (1 until N).map { today ->
        (0 until 3).forEach { todayActivity ->
            val yesterdayActivities = (0 until 3) - todayActivity

            happiness[today][todayActivity] = yesterdayActivities
                .map { yesterdayActivity -> happiness[today - 1][yesterdayActivity] }
                .max()!!
                .plus(abc[today][todayActivity])
        }
    }

    println(happiness[N - 1].max())
}