import java.util.*

fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    
    val arr = Array<Array<Int>>(n, { Array<Int>(3, { cin.nextInt() }) })

    val points = Array<Array<Int>>(n, { Array<Int>(3, { 0 }) })

    for (i in 0..n-1) {
        if (i == 0) {
            points[i][0] = arr[i][0]
            points[i][1] = arr[i][1]
            points[i][2] = arr[i][2]
        } else {
            points[i][0] = Math.max(points[i - 1][1] + arr[i][0], points[i - 1][2] + arr[i][0])
            points[i][1] = Math.max(points[i - 1][2] + arr[i][1], points[i - 1][0] + arr[i][1])
            points[i][2] = Math.max(points[i - 1][0] + arr[i][2], points[i - 1][1] + arr[i][2])
        }
    }
    println(Math.max(points[n-1][0], Math.max(points[n-1][1], points[n-1][2])))
}