// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define mp make_pair

#define pb push_back

#define emb emplace_back

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

#define N  99999

#define f first 

#define em emplace

#define s second

using lint=long long int;



typedef pair<int, int> pii;

typedef pair<double, double> pdd;

typedef vector<double> vd;

typedef vector<bool> vb;

typedef vector<int> vi;

typedef vector<vi> vvi;

typedef vector<vvi> vvvi;

typedef vector<string> vs;



 

#define fori(n) for(int i=0; i<int(n); i++)

 

#define cins(s) string s; cin>>s;

#define cini(i) lint i; cin>>i;

#define cind(d) double d; cin>>d;

#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }

#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }

#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

#define z 1000000007 

const int INF=1e9+5;

   vector<vector<int>> v(100005);

 

void cleari(){

  for(int i=0;i<99999;i++) v[i].clear();

}

 void solve(){



   cleari();

    

   cini(n); 

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

   {

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

        { 

          int a;

           cin>>a; 

           v[i].pb(a);

        }

   }

   

  int m;

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

    

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

          m=0;

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

         if(j!=k)

         {

            m=max(v[i-1][k],m);

         }

       }

       v[i][j]+=m;



     }



  }



  int mx=max(v[n-1][0],v[n-1][1]);

      mx=max(v[n-1][2],mx);



      cout<<mx<<endl;





     



 }





 

 

int main()

{ 

  fast;

 /* #ifndef ONLINE_JUDGE

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

  freopen("hex.txt","w",stdout);

  #endif*/

  







  solve();

 }

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

#define mp make_pair

#define pb push_back

#define emb emplace_back

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

#define N  99999

#define f first 

#define em emplace

#define s second

using lint=long long int;



typedef pair<int, int> pii;

typedef pair<double, double> pdd;

typedef vector<double> vd;

typedef vector<bool> vb;

typedef vector<int> vi;

typedef vector<vi> vvi;

typedef vector<vvi> vvvi;

typedef vector<string> vs;



 

#define fori(n) for(int i=0; i<int(n); i++)

 

#define cins(s) string s; cin>>s;

#define cini(i) lint i; cin>>i;

#define cind(d) double d; cin>>d;

#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }

#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }

#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

#define z 1000000007 





void solve(){

  

  cini(n);

  vector<int>dp(3);





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

     vector<int>v(3);



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

           cin>>v[j];

            int m=0;

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



              if(j!=k){

                m=max(dp[k],m);

              }

           }

           v[j]+=m;

     }

    dp.clear();

    v.swap(dp);

  }

     

     int a=*max_element(dp.begin(),dp.end());

     cout<<a<<endl;









}

 

 

int main()

{ 

 

  







  solve();

 }

// Fastest known solution for this problem: