
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n: Int = sc.nextInt()


    val motivations = Array(n){LongArray(3)}

    for(i in 0 until n) {
        for(j in 0 until 3) {
           motivations[i][j] = sc.nextLong()
        }
    }

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

    for(i in 1 until n) {
        for(j in 0 until 3) {
            val firstIndex = (j+1)  % 3
            val secondIndex = (j+2)  % 3
            dp[i][j] = motivations[i][j] + Math.max(dp[i-1][firstIndex], dp[i-1][secondIndex])
        }
    }

    println(Math.max(dp[n - 1][0], Math.max(dp[n - 1][1], dp[n - 1][2])))

}