// Original C++ solution (slower):
//Robs Code

/***********HEADER***************/

#include <iostream>

#include <bitset>

#include <deque>

#include <cstdio>

#include <cstring>

#include <cmath>

#include <string>

#include <algorithm>

#include <list>

#include <vector>

#include <unordered_set>

#include <unordered_map>

#include <stack>

#include <set>

#include <queue>

#include <map>

/***********MACROS***************/

#define int long long int

#define fri(l,k) for (i=l;i<=k;i++)

#define frj(l,k) for (j=l;j>=k;j--)

#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)

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

#define allr(x) x.rbegin(),x.rend()

#define endl "\n"

#define pb push_back

#define _1 first

#define _2 second

#define mxsz 1e5+10

#define mod 1e9 + 7

#define pii pair<int,int>

using namespace std;

const int N = 1e5 + 1;

int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];

/***********MAIN**************/

int v[(int)1e5+1][3];

int dp[(int)1e5+1][2][2][2];

int brute(int indx,int a,int b,int c){

	if(indx >= n){

		return 0;

	}

	if(dp[indx][a][b][c] != -1){

		return dp[indx][a][b][c];

	}

	int ans = -1;

	if(a){

		ans = max({ans,brute(indx+1,0,1,0) + v[indx][1],brute(indx+1,0,0,1) + v[indx][2]});

	}

	else if(b){

		ans = max({ans,brute(indx+1,1,0,0) + v[indx][0],brute(indx+1,0,0,1)+ v[indx][2]});

	}

	else if(c){

		ans = max({ans,brute(indx+1,0,1,0)+ v[indx][1],brute(indx+1,1,0,0)+ v[indx][0]});

	}else{

		ans = max({ans,brute(indx+1,1,0,0)+ v[indx][0],brute(indx+1,0,1,0)+ v[indx][1],brute(indx+1,0,0,1)+ v[indx][2]});

	}

	dp[indx][a][b][c] = ans;

	return ans;

}

signed main(){

	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	cin>>n;

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

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

	}

	memset(dp,-1,sizeof dp);

	cout<<(brute(0,0,0,0));

    return 0;

}

//.........

// Optimized solution to the same problem (faster):
//Robs Code

/***********HEADER***************/

#include <iostream>

#include <bitset>

#include <deque>

#include <cstdio>

#include <cstring>

#include <cmath>

#include <string>

#include <algorithm>

#include <list>

#include <vector>

#include <unordered_set>

#include <unordered_map>

#include <stack>

#include <set>

#include <queue>

#include <map>

/***********MACROS***************/

#define int long long int

#define fri(l,k) for (i=l;i<=k;i++)

#define frj(l,k) for (j=l;j>=k;j--)

#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)

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

#define allr(x) x.rbegin(),x.rend()

#define endl "\n"

#define pb push_back

#define _1 first

#define _2 second

#define pii pair<int,int>

using namespace std;

int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];

/***********MAIN**************/

signed main(){

	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	cin>>n;

	int mat[n][3];

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

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

			cin>>mat[i][j];

		}

	}

	int dp[n][3];

	dp[0][0] = mat[0][0];

	dp[0][1] = mat[0][1];

	dp[0][2] = mat[0][2];

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

		dp[i][0] = max(dp[i-1][1]+mat[i][0],dp[i-1][2]+mat[i][0]);

		dp[i][1] = max(dp[i-1][0]+mat[i][1],dp[i-1][2]+mat[i][1]);

		dp[i][2] = max(dp[i-1][1]+mat[i][2],dp[i-1][0]+mat[i][2]);

	}

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

	return 0;

}

//.........

// Fastest known solution for this problem: