#include<iostream>
#define MAXN 100002
using namespace std;
int n,k,a[MAXN],b[MAXN],c[MAXN];
int main()
{
	cin >> n;
	for(int i = 1;i <= n;i++)
	{
		cin >> a[i] >> b[i] >> c[i];
		a[i] = a[i] + max(b[i-1],c[i-1]);
		b[i] = b[i] + max(a[i-1],c[i-1]);
		c[i] = c[i] + max(a[i-1],b[i-1]);
	}
	int m = max(a[n],b[n]);
	cout<<max(m,c[n]);
}