'use strict'

const INF = 900719925474099 // Number.MAX_SAFE_INTEGER / 10;

function Main(input){
	let temp = input.trim().split('\n');
	let n = parseInt(temp[0]);
	let abc = new Array(n);

	for(let i=0;i<n;i++){
		abc[i] = temp[i+1].split(' ').map((v)=>parseInt(v));
	}

	let step = [...new Array(n+10)].map(()=>(new Array(3).fill(0)));
	//console.log(step);
	step[0][0]=abc[0][0];
	step[0][1]=abc[0][1];
	step[0][2]=abc[0][2];
	
	for(let i=1;i<n;i++){
		step[i][0] = abc[i][0] + Math.max( step[i-1][1] , step[i-1][2] );
		step[i][1] = abc[i][1] + Math.max( step[i-1][0] , step[i-1][2] );
		step[i][2] = abc[i][2] + Math.max( step[i-1][0] , step[i-1][1] );
	}
	console.log(Math.max(...step[n-1]));
}

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