"use strict";
function Main(input) {
    let lines = input.split("\n");
    let N = lines[0] - 0;
    let Is = new Array(N+1);
    for (let n = 1; n <= N; n++) Is[n] = lines[n].split(/\s/).map((v) => v - 0);
    Is[0] = [0, 0, 0];

    let dp = new Array(Is.length).fill(0).map((v) => [0, 0, 0]);
    for (let n = 1; n <= N; n++)
        for (let j = 0; j < 3; j++)
            for (let k = 0; k < 3; k++)
                if (k != j) 
                    dp[n][k] = Math.max(dp[n][k], dp[n-1][j] + Is[n][k]);

    console.log(Math.max(...dp[N]));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
