#include<bits/stdc++.h>
#define N 100010
using namespace std;
int a[N][3];
int dp[N][3];
int n;
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 0; j <= 2; j++)
		{
			cin >> a[i][j];
			dp[i][j] = max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]) + a[i][j];
		}
	}
	cout << max(dp[n][0],max(dp[n][1], dp[n][2]));
	return 0;
}