#include<bits/stdc++.h>
#define ll long long int
#define loop(i,a,b) for(ll i=a;i<b;i++)
using namespace std;
int main()
{
	ll n;
	cin>>n;
	ll a[n],b[n],c[n];
	loop(i,0,n) cin>>a[i]>>b[i]>>c[i];
	loop(i,1,n)
	{
		a[i]+= max(b[i-1],c[i-1]);
		b[i]+= max(a[i-1],c[i-1]);
		c[i]+= max(a[i-1],b[i-1]);
	}
	cout<<max(a[n-1],max(b[n-1],c[n-1]));	
	return 0;
}