import java.lang.Math.*
import java.util.*

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val N = scn.nextInt()

    var a = IntArray(4)
    var dp = Array(N+1, {IntArray(4)})

    for(i in 1..N) {
        for (j in 1..3) {
            a[j] = scn.nextInt()
        }
        for(j in 1..3){
            for(k in 1..3){
                if(j==k) continue
                dp[i][j] = max( dp[i][j], dp[i-1][k] + a[j])
            }
        }
    }

    println(max(max(dp[N][1], dp[N][2]), dp[N][3]))
}
