'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf8');

// Your code here!
const max = (a)=>{
    let i = a.length;
    let max=-Infinity;
    while (i--) {
        if (a[i] > max)max = a[i];
    }
    return max;
}
const min = (a)=>{
    let i = a.length;
    let max=Infinity;
    while (i--) {
        if (a[i] < max)max = a[i];
    }
    return max;
}
const Main = (p)=>{
	p = p.split("\n");//2 or more
	let N = parseInt(p[0]);//N
	//let N = parseInt(p[0].split(" ")[0]);//N M
	//let K = parseInt(p[0].split(" ")[1]);//N M
	//let h = (p[1].split(" ").map(Number));//a1 a2 a3...
	
	let a=new Array(N);
	let b=new Array(N);
	let c=new Array(N);
    let z=new Array(N+1);
    for(let i=0;i<N;i++){
        let h = (p[i+1].split(" ").map(Number));
        z[i]=new Array(3);
        a[i]=h[0];
        b[i]=h[1];
        c[i]=h[2];
        z[i]=[a[i],b[i],c[i]];
    }
	let m = new Array(N);
    m[0]=z[0];
    //console.log(N,a,b,c);
    //return;
    for(let i=1;i<N;i++){
        let t=[0,0,0];
        for(let j=0;j<3;j++){
            t[j]=+z[i][j]+Math.max(m[i-1][(j+1)%3],m[i-1][(j+2)%3])
        }
        //console.log(t);
        m[i]= (t);
    }
	//console.log(c);
	console.log(max(m[N-1]));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
