'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function getArray(str) {
    return str.split(' ').map(x => Number(x));
}

function getInt(str) {
    return Number(str);
}

function getStrArray(str) {
    return str.split(' ').map(x => x);
}
// ---------------------------------------



function main() {
    let n = getInt(readline());
    let totalArray = getArray(readline());
    // console.log(totalArray);
    while(n > 1) {
        const x = getArray(readline());
        const temp0 = x[0] + Math.max(totalArray[1], totalArray[2]);
        const temp1 = x[1] + Math.max(totalArray[0], totalArray[2]);
        const temp2 = x[2] + Math.max(totalArray[0], totalArray[1]);
        totalArray = [temp0, temp1, temp2];
        // console.log(totalArray);
        n--;
    }
    console.log(Math.max(totalArray[0], Math.max(totalArray[1], totalArray[2])));
}