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

void main() {
	int n;
	readf("%s\n", &n);

	auto happinessTable = new int[][3];
	foreach (ref e;happinessTable) {
		e = new int[n];
	}

	foreach (i;0..n) {
		readf(
			" %s %s %s\n",
			&happinessTable[0][i],
			&happinessTable[1][i],
			&happinessTable[2][i]
		);
	}

	auto dp = new int[][3];
	foreach (ref e;dp) {
		e = new int[n + 1];
	}
	
	foreach (i;0..n) {
		dp[0][i + 1] = max(dp[1][i], dp[2][i]) + happinessTable[0][i];
		dp[1][i + 1] = max(dp[0][i], dp[2][i]) + happinessTable[1][i];
		dp[2][i + 1] = max(dp[0][i], dp[1][i]) + happinessTable[2][i];
	}

	writeln(max(dp[0][n], dp[1][n], dp[2][n]));
}
