// Original C++ solution (slower):
//long time no ac

#include<bits/stdc++.h>

using namespace std;



#define debug(x) cout<<#x<<" :: "<<x<<"\n";

#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";

#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";



#define     SPEED       ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

#define 	setprecn(x) cout<<fixed<<setprecision(x);

#define 	ll          long long int

#define 	pb          push_back

#define 	pll         pair<ll,ll>

#define 	vll         vector<ll>

#define 	ff          first

#define 	ss          second

#define 	all(a)      (a).begin(),(a).end()

#define 	sz(x)       (ll)x.size()

#define 	hell        1000000007

#define 	rep(i,n)    for(ll i=0;i<n;i++)

#define 	repe(i,a,b) for(ll i=a;i<b;i++)

#define 	lbnd        lower_bound

#define 	ubnd        upper_bound

#define 	bs          binary_search

#define 	mp          make_pair



ll power(ll a,ll b)

{

	if(b==0)

		return 1;

	if(b==1)

		return a;

	ll c=power(a,b/2);

	if(b%2==0)

		return((c%hell)*(c%hell))%hell;

	return ((((c%hell)*(c%hell))%hell)*(a%hell))%hell;

}



/********************************************************/

//	d.erase(unique(all(d)), d.end());

#define N 100005





ll a[N][3],dp[N][3],n;



ll f(ll x,ll l)

{

	if(x>n-1) return 0;

	if(dp[x][l]==-1)

	{

		dp[x][l]=0;

		rep(i,3)

		{

			// debug3(x,l,dp[x][l]);

			if(i==l && x!=0) continue;

			dp[x][l]=max(dp[x][l],a[x][i]+f(x+1,i));

		}

	}

	return dp[x][l];

}



int main()

{

	SPEED;

	ll k,t,j,m,cs=0;

	t=1;



	// cin>>t;

	string s;

	while(t--)

	{

		cin>>n;

		// n=s.length();

		// ll a[n];

		rep(i,n)

		{

			cin>>a[i][0]>>a[i][1]>>a[i][2];

		}

		memset(dp,-1,sizeof(dp));

		cout<<f(0,0);

		if(t!=0)

	   		cout<<"\n";

	}

	return 0;

}

// Optimized solution to the same problem (faster):
//long time no ac

#include<bits/stdc++.h>

using namespace std;



#define debug(x) cout<<#x<<" :: "<<x<<"\n";

#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";

#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";



#define     SPEED       ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

#define 	setprecn(x) cout<<fixed<<setprecision(x);

#define 	ll          long long int

#define 	pb          push_back

#define 	pll         pair<ll,ll>

#define 	vll         vector<ll>

#define 	ff          first

#define 	ss          second

#define 	all(a)      (a).begin(),(a).end()

#define 	sz(x)       (ll)x.size()

#define 	hell        1000000007

#define 	rep(i,n)    for(ll i=0;i<n;i++)

#define 	repe(i,a,b) for(ll i=a;i<b;i++)

#define 	lbnd        lower_bound

#define 	ubnd        upper_bound

#define 	bs          binary_search

#define 	mp          make_pair



ll power(ll a,ll b)

{

	if(b==0)

		return 1;

	if(b==1)

		return a;

	ll c=power(a,b/2);

	if(b%2==0)

		return((c%hell)*(c%hell))%hell;

	return ((((c%hell)*(c%hell))%hell)*(a%hell))%hell;

}



/********************************************************/

//	d.erase(unique(all(d)), d.end());

#define N 100005





ll a[N][3],dp[N][3],n;



ll f(ll x,ll l)

{

	if(x>n-1) return 0;

	if(dp[x][l]==-1)

	{

		dp[x][l]=0;

		rep(i,3)

		{

			// debug3(x,l,dp[x][l]);

			if(i==l && x!=0) continue;

			dp[x][l]=max(dp[x][l],a[x][i]+f(x+1,i));

		}

	}

	return dp[x][l];

}



int main()

{

	SPEED;

	ll k,t,j,m,cs=0;

	t=1;



	// cin>>t;

	string s;

	while(t--)

	{

		cin>>n;

		// n=s.length();

		// ll a[n];

		rep(i,n)

		{

			cin>>a[i][0]>>a[i][1]>>a[i][2];

		}

		// memset(dp,-1,sizeof(dp));

		rep(i,n)

		{

			rep(j,3) rep(k,3)

			{

				if(j==k) continue;

				dp[i+1][k]=max(dp[i+1][k],a[i][k]+dp[i][j]);

			}

		}

		cout<<max({dp[n][0],dp[n][1],dp[n][2]});

		if(t!=0)

	   		cout<<"\n";

	}

	return 0;

}

// Fastest known solution for this problem: