// Slower C++ solution:
#include "bits/stdc++.h"

using namespace std; 

#define LIM 100003



#define M 1000000007

#define inf 99999999999999999LL	//long long inf

typedef long long ll;



#define sc(x) scanf("%d",&x);

#define sc2(x,y) scanf("%d%d",&x,&y);

#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z);

#define scl(x) scanf("%lld",&x);

#define scl2(x,y) scanf("%lld%lld",&x,&y);

#define scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z);



#define pb push_back

#define mp make_pair

#define fi first

#define se second 

ll power(ll x,ll y,ll z) {	ll ret = 1;	while(y > 0) {	if(y & 1) ret = (ret*x)%z;x = (x*x)%z;y >>= 1;}return ret;}





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

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

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

#define debug4(x,y,z,a) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#a<<" :: "<<a<<"\n";







ll n, arr[LIM][3], dp[LIM][3] ;

ll doit(ll ind, ll last) {

	if(ind > n)

		return 0;

	ll &dpAnswer = dp[ind][last] ;

	if( dpAnswer != -1 )

		return dpAnswer ;

	ll answer = 0 ;

	for(ll i=0; i<3;i++) {

		if(last == i)

			continue;

		answer = max(answer, arr[ind][i]+doit(ind +1, i)) ;

	}

	return dpAnswer = answer ;

}

int main() {

	int i, j, t;

	memset(dp, -1, sizeof dp) ;

	scl(n) ;

	for(i=1; i<=n; i++)

		scl3(arr[i][0], arr[i][1], arr[i][2]) ;

	ll answer = doit(1, -1) ;

	cout << answer << endl ;

	return 0;

}






// Faster C++ solution for the same problem (measured speedup: 3.431180243815419x):
#include "bits/stdc++.h"

using namespace std; 

#define LIM 100003



#define M 1000000007

#define inf 99999999999999999LL	//long long inf

typedef long long ll;



#define sc(x) scanf("%d",&x);

#define sc2(x,y) scanf("%d%d",&x,&y);

#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z);

#define scl(x) scanf("%lld",&x);

#define scl2(x,y) scanf("%lld%lld",&x,&y);

#define scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z);



#define pb push_back

#define mp make_pair

#define fi first

#define se second 

ll power(ll x,ll y,ll z) {	ll ret = 1;	while(y > 0) {	if(y & 1) ret = (ret*x)%z;x = (x*x)%z;y >>= 1;}return ret;}





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

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

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

#define debug4(x,y,z,a) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#a<<" :: "<<a<<"\n";







ll n, arr[LIM][3], dp[LIM][3] ;

ll doit(ll ind, ll last) {

	if(ind > n)

		return 0;

	ll &dpAnswer = dp[ind][last] ;

	if( dpAnswer != -1 )

		return dpAnswer ;

	ll answer = 0 ;

	for(ll i=0; i<3;i++) {

		if(last == i)

			continue;

		answer = max(answer, arr[ind][i]+doit(ind +1, i)) ;

	}

	return dpAnswer = answer ;

}

ll doit1() {

	ll maxi = 0, i, j, k;

	for(i=1; i<=n; i++) {



		for(j=0 ;j<3; j++) {



			for(k=0; k <3; k++) {

				if(k != j )

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

			}

		}

	}

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

}

int main() {

	int i, j, t;

	scl(n) ;

	for(i=1; i<=n; i++)

		scl3(arr[i][0], arr[i][1], arr[i][2]) ;

	ll answer = doit1() ;

	cout << answer << endl ;

	return 0;

}