import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;

string my_readln() { return chomp(readln()); }

void main()
{//try{
	auto tokens = split(my_readln());
	auto N = to!ulong(tokens[0]);

	ulong[] a, b, c;
	foreach (i; 0..N)
	{
		auto tokens2 = split(my_readln());
		{
			a ~= to!ulong(tokens2[0]);
			b ~= to!ulong(tokens2[1]);
			c ~= to!ulong(tokens2[2]);
		}
	}

	ulong[3][] bn;
	bn.length = N;
	bn[0][0]  = a[0];
	bn[0][1]  = b[0];
	bn[0][2]  = c[0];

	foreach (i; 0..N-1)
	{
		bn[i+1][0] = max(bn[i][1], bn[i][2]) + a[i+1];
		bn[i+1][1] = max(bn[i][0], bn[i][2]) + b[i+1];
		bn[i+1][2] = max(bn[i][0], bn[i][1]) + c[i+1];
	}

	writeln(max(max(bn[N-1][0], bn[N-1][1]), bn[N-1][2]));
	stdout.flush();
	/*}catch (Throwable e)
	{
	writeln(e.toString());
	}
	readln();*/
}