import java.lang.Math.max

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

    val hs = arrayListOf<List<Int>>()

    for (i in 0 until n) {
        val li = readLine()!!.split(" ").map(String::toInt)
        hs.add(li)
    }

    val dp = Array(n + 1) { arrayOf(0L, 0L, 0L) }

    for (i in 1 until dp.size) {
        if (i == 0)
            continue
        for (j in 0..2) {
            for (k in 0..2) {
                if (j == k)
                    continue
                dp[i][j] = max(dp[i][j], dp[i - 1][k] + hs[i - 1][j])
            }
        }
    }

    println(dp.last().max())

}
