fun main(args: Array<String>) {
    edpc()
}

fun edpc() {
    val n = readLine()!!.toInt()
    val vacations = (1..n)
        .map { readLine()!!.split(" ").map { it.toLong() } }

    val dp = Array(n + 1) { LongArray(3) { 0 } }
    dp[0][0] = vacations[0][0]
    dp[0][1] = vacations[0][1]
    dp[0][2] = vacations[0][2]

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

    val answer = dp[n - 1].max()!!

    println(answer)
}
