// Slower C++ solution:
#include <cstring>

#include <iostream>

using namespace std;

const int MAXN=1e5+7;

int n,ans;

int h[MAXN][5],f[MAXN][5][5];

int main()

{

	cin>>n;

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

		cin>>h[i][1]>>h[i][2]>>h[i][3];

	memset(f,127,sizeof(f));

	for(int i=1;i<=3;i++)

		for(int j=1;j<=3;j++) f[1][i][j]=h[1][i];

	for(int i=2;i<=n;i++)

		for(int j=1;j<=3;j++)

			for(int k=1;k<=3;k++)

			{

				int maxx=0;

				for(int l=1;l<=3;l++)

					if(j!=k&&k!=l) maxx=max(maxx,f[i-1][k][l]);

				f[i][j][k]=maxx+h[i][j];

			}

	for(int i=1;i<=3;i++)

		for(int j=1;j<=3;j++) ans=max(ans,f[n][i][j]);

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 11.52378462005221x):




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

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

/**                                                  **/

/**            BISMILLAHIR RAHMANIR RAHIM            **/

/**         REAZ AHAMMED CHOWDHURY - reaziii         **/

/**  Department of Computer Science and Engineering  **/

/*         INSTITUTE OF SCIENCE AND TECHNOLOGY       **/

/**                                                  **/

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

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







#include<bits/stdc++.h>

#define sc(x)        scanf("%lld",&x)

#define pcase(x)     printf("Case %d: ",x++)

#define pn           printf("\n")

#define fri(f)       for(int i=0;i<f;i++)

#define frj(f)       for(int j=0;j<f;j++)

#define reset(x,e)   memset(x,e,sizeof(x))

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

#define input        freopen("input.txt","r",stdin);

#define output       freopen("output.txt","w",stdout)

#define infi         INT_MAX

#define m_v          3000000

#define pii          pair<int,int>

#define pch          pair<char,char>

#define pll          pair<ll,ll>

#define mgraph       map<int,vector<int> >

#define mp           make_pair

#define pb           push_back

#define clr(x)       memset(x,0,sizeof(x))

#define frx(x,y)     for(int x=0;x<y;x++)

#define ff           first

#define ss           second

using namespace std;

typedef long long int ll;

typedef unsigned long long int ull;

bool checkbitt(ll num, int pos);

ll setbitt(ll num, ll pos);

ll resetbitt(ll num, int pos);

void read(int *aa, int sz) {fri(sz) scanf("%d", (aa + i));}

void read(ll *aa, int sz) {fri(sz) scanf("%lld", (aa + i));}

void read(ll *aa, int s, int e) {for (int i = s; i < s + e; i++)scanf("%lld", (aa + i));}

void read(int *aa, int s, int e) {for (int i = s; i < s + e; i++)scanf("%d", (aa + i));}

const ll mod =       1e9 + 7;

const ll N =     1e6 + 10;



//.................___Start from here___.................//

//.................._____________________................//



int n;

int dp[N][5];

int a[N], b[N], c[N];

int A = 1, B = 2, C = 3;

int solve() {

	cin >> n;



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

		cin >> a[i] >> b[i] >> c[i];

	}





	for (int i = n; i >= 1; i--) {

		dp[i][A] = max(dp[i + 1][B], dp[i + 1][C]) + a[i];

		dp[i][B] = max(dp[i + 1][A], dp[i + 1][C]) + b[i];

		dp[i][C] = max(dp[i + 1][A], dp[i + 1][B]) + c[i];

	}



	cout << max(dp[1][A], max(dp[1][B], dp[1][C])) << endl;







	return 0;

}

int main() {

// #ifndef ONLINE_JUDGE

// 	input;

// 	output;

// #endif

// #ifdef ONLINE_JUDGE

// 	ios_base::sync_with_stdio(false);

// 	cin.tie(0);

// #endif

	int cs = 1;

	int cn = 1;

	//cin>>cs;

	while (cs--) {

		solve();



	}

}





bool checkbitt(ll num, int pos) {return (num >> pos) & 1;}

ll setbitt(ll num, ll pos) {return (1 << pos) | num;}

ll resetbitt(ll num, int pos) {if (!checkbitt(num, pos)) return num; else return (1 << pos)^num;}