#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
//auto->.
//map<int,int>::iterator i

vector<int> sieve(int n) 
{ 

    vector<bool> prime(n+1,true); 
       
    prime[0] = false; 
    prime[1] = false; 
    int m = sqrt(n); 
   vector<int> ans;
    for (int p=2; p<=m; p++) 
    { 
    
        if (prime[p]) 
        { 
         
            for (int i=p*2; i<=n; i += p) 
            prime[i] = false; 
        } 
    }  
    //vector<int> ans; 
    for (int i=0;i<n;i++) 
        if (prime[i]) 
            ans.push_back(i); 
    return ans; 
}

int gcd(int a,int b)
{
	if(b==0) return a;
	return gcd(b,a%b);
}
int mod = 1e9 + 7;
int power(int a , ll b)
{
	int res = 1;
	while(b)
	{
		if(b & 1)
			res = 1LL * res * a % mod;
		a = 1LL * a * a % mod;
		b >>= 1;
	}
	return res;
}
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}
ll min(int a,ll b)
{
	if(a>b)
	return b;
	return a;
}
ll max(int a,ll b)
{
	if(a>b)
	return a;
	return b;
}
ll myXOR(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}
int conti(int x)
{
	if(x<1)
	return 0;
	if(x%4==0)
	return x;
	if(x%4==1)
	return 1;
	if(x%4==2)
	return x+1;
	if(x%4==3)
	return 0;
}
  
bool ispfsq(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is an integer 
  return ((sr - floor(sr)) == 0); 
}
ll cnt(ll x,ll lcm,ll m)
{
return (x/lcm)*m + min(m,x-(x/lcm)*lcm+1);

}
#define PI 3.141592653589793
int n;
int fen[1000010];
void update(int i,int d)
{
	fen[i]+=d;
	for(;i<n;i+=(i&(-1*i)))
	 fen[i]+=d;
}
int sum(int ind)
{
	int s=0;
	while(ind>0)
	{
		s+=fen[ind];
		ind-=ind&(-1*ind);
	}
	return s;
}
int a[30002],b[30002];
void solve()
{
int n;
cin>>n;
int arr[n][3],dp[n][2][2][2];
for(int i=0;i<n;i++)
{
	for(int j=0;j<3;j++)
	{
	
cin>>arr[i][j];
}
dp[i][1][0][0]=0;
dp[i][0][1][0]=0;
dp[i][0][0][1]=0;
}
dp[0][1][0][0]=arr[0][0];
dp[0][0][1][0]=arr[0][1];
dp[0][0][0][1]=arr[0][2];
for(int i=1;i<n;i++)
{
	dp[i][1][0][0]=max(arr[i][0]+dp[i-1][0][1][0],arr[i][0]+dp[i-1][0][0][1]);
	dp[i][0][1][0]=max(arr[i][1]+dp[i-1][1][0][0],arr[i][1]+dp[i-1][0][0][1]);
	dp[i][0][0][1]=max(arr[i][2]+dp[i-1][1][0][0],arr[i][2]+dp[i-1][0][1][0]);
}
cout<<max(dp[n-1][1][0][0],max(dp[n-1][0][1][0],dp[n-1][0][0][1]));
}


   
/*void dfs(vector<int> adj[],bool visited[],int a)
{
	if(visited[a]==false)
	visited[a]=true;
	else
	return;
	v++;
	e+=adj[a].size();
	for(int i=0;i<adj[a].size();i++)
	{
		
		if(!visited[adj[a][i]])
		{
		
		dfs(adj,visited,adj[a][i]);

	      }
	}
	}	
*/	
	


/*int dfs(vector<int> adj[],int v,int c,int p)
{
//	cout<<p<<" "<<v<<" "<<c<<"\n";
	c+=arr[v];
	if(c>m)
	{
	return 0;
    }
	if(adj[v].size()==1&&v!=1)
	return 1;
	int a=0;
	for(int i=0;i<adj[v].size();i++)
	{
		if(adj[v][i]!=p)
		{
			
			int x=dfs(adj,adj[v][i],c*arr[adj[v][i]],v);
			a+=x;
		}
	}
	return a;
}
*/

int main()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//func();
int mul=0;
if(mul==1)
{
 int t;
 
    cin>>t;
   while(t--)
    {
		solve();
	cout<<"\n";
    }
}
else
{
	solve();
}
}

Measured memory_bytes: 4608