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



using namespace std;

const int OO = 0x3f3f3f3f;

//const long long OO = (long long) 5e18+7;

//const unsigned long long UOO = (long long) 10e18+7;

#define lp(i,a,n) for(long long i = a ; i < n ; ++i)

#define lpr(i,a,n) for(long long i = a ; i >= n ; --i)

#define rep(i,vec) for(ll i = 0 ; i < vec.size() ; ++i)

#define reprv(i,vec) for(ll i = vec.size()-1; i >=0 ; --i)

#define eps (1e-5)

#define pb(i) push_back(i)

#define EPS 1e-9

#define sz(x) int((x).size())

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

#define ff first

#define ss second

#define debug(x) cout<<(#x)<<": \""<<x<<"\""<<endl

#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl



typedef vector<int> vi ;

typedef   long long ll;

typedef   unsigned long long ull;

typedef vector<ll> vll ;

typedef pair<int,int> pii ;

typedef vector< pair<int,int> >  vpii;

typedef vector<pair<long long,long long>> vpll;

typedef vector<vector<int> > vvi ;

typedef complex<double> point;

typedef pair<ll,ll> pll;



using namespace std;

ll  inv(ll a, ll b) {return 1 < a ? b - inv(b % a, a) * b / a : 1;}

ll  Pow(ll  B,ll  P){ll  R=1; while(P>0)  {if(P&1) R=(R*B);P/=2;B=(B*B);}return R;} //compute b^p

ll  GCD(ll  a,ll  b){ while(b){b ^= a ^=b ^= a %=b;}  return a;}

ll  LCM(ll  a,ll  b) { return (a / GCD(a,b)*b); }

ll  BigMod(ll  B,ll  P,ll  M){ ll  R=1; while(P>0)  {if(P&1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (ll )R;} //compute b^p%m

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//int i=uniform_int_distribution<int>(1,n)(rng);





int N;

int v[100005][3];

int mem[100005][3];





int dp(int pos,int last){

    if(pos==N) return 0;

    int ans = 0;

    if(last != -1 && mem[pos][last] != -1) return mem[pos][last];

    lp(i,0,3)if(i!=last){

        ans = max(ans,v[pos][i]+dp(pos+1,i));

    }

    return mem[pos][max(0,last)] = ans;

}











int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

//    cout.tie(0);

//#ifndef ONLINE_JUDGE

//   freopen( "output.txt" , "w" , stdout ) ;

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

//#endif



    cin >> N ;

    lp(i,0,N)lp(j,0,3) cin >> v[i][j];

    memset(mem,-1,sizeof mem);

    cout << dp(0,-1);





    return 0;

}


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



using namespace std;

const int OO = 0x3f3f3f3f;

//const long long OO = (long long) 5e18+7;

//const unsigned long long UOO = (long long) 10e18+7;

#define lp(i,a,n) for(long long i = a ; i < n ; ++i)

#define lpr(i,a,n) for(long long i = a ; i >= n ; --i)

#define rep(i,vec) for(ll i = 0 ; i < vec.size() ; ++i)

#define reprv(i,vec) for(ll i = vec.size()-1; i >=0 ; --i)

#define eps (1e-5)

#define pb(i) push_back(i)

#define EPS 1e-9

#define sz(x) int((x).size())

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

#define ff first

#define ss second

#define debug(x) cout<<(#x)<<": \""<<x<<"\""<<endl

#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl



typedef vector<int> vi ;

typedef   long long ll;

typedef   unsigned long long ull;

typedef vector<ll> vll ;

typedef pair<int,int> pii ;

typedef vector< pair<int,int> >  vpii;

typedef vector<pair<long long,long long>> vpll;

typedef vector<vector<int> > vvi ;

typedef complex<double> point;

typedef pair<ll,ll> pll;



using namespace std;

ll  inv(ll a, ll b) {return 1 < a ? b - inv(b % a, a) * b / a : 1;}

ll  Pow(ll  B,ll  P){ll  R=1; while(P>0)  {if(P&1) R=(R*B);P/=2;B=(B*B);}return R;} //compute b^p

ll  GCD(ll  a,ll  b){ while(b){b ^= a ^=b ^= a %=b;}  return a;}

ll  LCM(ll  a,ll  b) { return (a / GCD(a,b)*b); }

ll  BigMod(ll  B,ll  P,ll  M){ ll  R=1; while(P>0)  {if(P&1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (ll )R;} //compute b^p%m

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//int i=uniform_int_distribution<int>(1,n)(rng);





int N;

int v[100005][3];

int mem[100005][3];









int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

//    cout.tie(0);

//#ifndef ONLINE_JUDGE

//   freopen( "output.txt" , "w" , stdout ) ;

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

//#endif



    cin >> N ;

    lp(i,0,N)lp(j,0,3) cin >> v[i][j];



    lp(i,0,3) mem[N-1][i] = v[N-1][i];



    lpr(i,N-1,1)lp(j,0,3){



        lp(k,0,3)if(j!=k){

            mem[i-1][k] = max(mem[i-1][k],mem[i][j]+v[i-1][k]);

        }

    }

    cout << max(mem[0][0],max(mem[0][1],mem[0][2]));



    return 0;

}