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 ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = parseInt(a[i]);

    return a;
}

function main(){
    let n = parseInt(readline());
    let a  = new Array(n);
    let b = new Array(n);
    let c = new Array(n);

    for(let i = 0; i < n; i++){
        let [x,y,z] = ti(readline().split(' '));
        a[i] = x;
        b[i] = y;
        c[i] = z;
    }

    let dpA = new Array(n);
    let dpB = new Array(n);
    let dpC = new Array(n);

    for(let i = 0; i < n; i++){
        if(i === 0){
            dpA[i] = a[i];
            dpB[i] = b[i];
            dpC[i] = c[i];
        }else{
            dpA[i] = Math.max(dpB[i-1] + a[i], dpC[i-1] + a[i]);
            dpB[i] = Math.max(dpA[i-1] + b[i], dpC[i-1] + b[i]);
            dpC[i] = Math.max(dpB[i-1] + c[i], dpA[i-1] + c[i]);
        }
    }

    console.log(Math.max(dpA[n-1], dpB[n-1], dpC[n-1]));
}