import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

/*
x: i日目にAをするときの最大
y: i日目にBをするときの最大
z: i日目にCをするときの最大

漸化式は
x = as[i] + max(y, z)
y = bs[i] + max(x, z)
z = cs[i] + max(x, y)

*/

void main(){
	long n = read.to!long;
	long[3][] xs;
	foreach(i; 0 .. n){
		xs ~= [read.to!long, read.to!long, read.to!long];
	}
	
	long[3] ans = [0, 0, 0];
	foreach(x; xs){
		ans = [
				x[0] + max(ans[1], ans[2]),
				x[1] + max(ans[0], ans[2]),
				x[2] + max(ans[0], ans[1])
				];
	}
	
	max(ans[0], ans[1], ans[2]).writeln;
}
