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

#define ll long long

#define ff first

#define ss second

#define mp make_pair

#define mod(d) d%1000000007

#define loop(i,s,e) for(ll i=s;i<e;i++)

#define vll vector<ll>

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

using namespace std;



const int MAX = 1e5+5;

vector<int> V[MAX];

bool cnt[3];

int dp[100000][3];



int MaxHappiness(vector<int> V[MAX],ll n){	

		dp[0][0]=V[0][0];	

		dp[0][1]=V[0][1];	

		dp[0][2]=V[0][2];	

		loop(i,1,n){

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

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

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

		}



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

}



int main(){

	

	ios_base:: sync_with_stdio(false);

    cin.tie(NULL); cout.tie(NULL);



    loop(i,0,3)cnt[i]=false;

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

    ll n;

    cin>>n;

    loop(i,0,n){

    	int x,y,z;

    	cin>>x>>y>>z;



    	V[i].push_back(x);

    	V[i].push_back(y);

    	V[i].push_back(z);

    }



    cout<<MaxHappiness(V,n)<<'\n';



    // loop(i,0,n){

    // 	loop(j,0,3){

    // 		cout<<dp[i][j]<<" ";

    // 	}

    // 	cout<<'\n';

    // }



   

}


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

#include <ext/pb_ds/assoc_container.hpp> 

#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;

using namespace std;

 

#define ff                  first

#define ss                  second

#define endl                "\n"

#define loop(i,s,e)         for(int i=s;i<e;i++)

#define int                 long long

#define vi                  vector<int> 

#define S(v)                sort(v.begin(),v.end())

#define RS(v)               sort(v.rbegin(),v.rend())

#define R(v)                reverse(v.begin(),v.end())

#define mxpq(T)             priority_queue <T>

#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>

#define prv(v)              for(auto &x : v)cout << x << " ";

#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;

#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";

#define mp                  make_pair

#define pii                 pair<int,int>

#define mset(a,f)           memset(a , f , sizeof(a))

#define pb                  push_back

#define inf                 INT_MAX

#define INF                 LLONG_MAX

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;



const int N = 2e6 + 6;



class var

{

public:

    int ai , bi , ci;

};



var A[N];

int dp[N][3];

int n , k;





void solve()

{

    cin >> n;



    loop(i,1,n+1)cin >> A[i].ai >> A[i].bi >> A[i].ci;



    loop(i,0,n+1)dp[i][0] = 0 , dp[i][1] = 0 ,dp[i][2] = 0;



    // dp[0] = 0;

    dp[1][0] = A[1].ai;

    dp[1][1] = A[1].bi;

    dp[1][2] = A[1].ci;



    loop(i,2,n+1)

    {

        loop(j,0,3)

        {

            if(j == 0)dp[i][j] = max({dp[i-1][1],dp[i-1][2]}) + A[i].ai;

            if(j == 1)dp[i][j] = max({dp[i-1][0],dp[i-1][2]}) + A[i].bi;

            if(j == 2)dp[i][j] = max({dp[i-1][0],dp[i-1][1]}) + A[i].ci;

        }

    }



    int ans = 0;



    loop(i,0,3)ans = max(dp[n][i] , ans);   



    cout << ans;

}

 

int32_t main()

{

 

cout<<fixed<<setprecision(16);



ios_base:: sync_with_stdio(false);

cin.tie(NULL); cout.tie(NULL);

     



     int t = 1;

     // cin >> t;

     while(t--)solve();

  

}