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



using namespace std;



vector<vector<int> > v;

int ans[100005][3];

queue<pair<int,pair<int,int> > >s;

int maior,a=0;



void dp(int i, int bloq, int sum) {

  if(ans[i-1][bloq]>sum)

    return;

  

  if (i>=v.size())

    maior = max(sum, maior);

  else {

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

      if (bloq != j) {



        if(ans[i][j]==-1) {

          ans[i][j] = sum+v[i][j];

          s.push({sum+v[i][j],{i+1,j}});

        }

        else if (ans[i][j]<sum+v[i][j]) {

          ans[i][j] = sum+v[i][j];

          s.push({sum+v[i][j],{i+1,j}});

        }



        //dp(i+1, j, sum+v[i][j]);

      }

    }

  }

}



int main () {

  int n;

  cin>>n;

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

    int a,b,c;

    cin>>a>>b>>c;

    v.push_back({a,b,c});

  }



  maior=0;

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

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

    s.push({v[0][i],{1,i}});

    //dp(1, i, v[0][i]);

  }



  while(!s.empty()) {

    pair<int,pair<int,int> > aux = s.front();

    dp(aux.second.first, aux.second.second, aux.first);

    s.pop();

  }



  cout<<maior<<endl;



}




// Faster C++ solution for the same problem (measured speedup: 2.152115704840625x):
///#pragma GCC optimize("Ofast")

///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

///#pragma GCC optimize("unroll-loops")



#include<bits/stdc++.h>

using namespace std;



///#include<ext/pb_ds/assoc_container.hpp>

///#include<ext/pb_ds/tree_policy.hpp>

///using namespace __gnu_pbds;

///template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

///(X).order_of_key(value) /// return lower_bound(value)

///(*X).find_by_order(index) /// return value (0 index)



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



typedef unsigned long long ull;

typedef long long ll;

typedef long double ld;

typedef vector<int> vii;

typedef vector<ll> vll;

typedef vector<vll> vvll;

typedef vector<vii> vvii;

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;

typedef vector<pii> vpii;

typedef vector<pll> vpll;

typedef vector<bool> vbb;



const int N = 1000001;

const int MOD = 1000000007;

const ll INF = LLONG_MAX;



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

#define next(x) next_permutation(all(x))

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

#define rall(a) a.rbegin(),a.rend()

#define rev(a) reverse(all(a))

#define eb emplace_back

#define pb push_back

#define mp make_pair

#define ff first

#define ss second

#define yes cout<<"YES"<<nl

#define no cout<<"NO"<<nl

#define space ' '

#define nl '\n'

#define PI acos(-1)

#define Case(x) cout<<"Case "<<x<<": "

#define strtoint(a) atoi(a.c_str())

#define dbg(x) cerr<<#x<<" is "<<x<<'\n';

#define fix(x) cout<<fixed<<setprecision(x)

#define leastonepos(x) __builtin_ffs(x)

#define leadingoff(x) __builtin_clz(x)

#define trailingoff(x) __builtin_ctz(x)

#define numofone(x) __builtin_popcount(x)

#define time() cerr<<"Time elapsed : "<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<'\n'



#define coutv(v) for(auto it:v)cout<<it<<space;cout<<nl;

#define cinv(v) for(auto &it:v)cin>>it;



///................Graph's Move.................

///const int dx[] = {+1,-1,+0,+0}; ///Rock's Move

///const int dy[] = {+0,+0,+1,-1}; ///Rock's Move

///const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move

///const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move

///const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's Move

///const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's Move

///*.....................-_-........................*///







int main()

{

    fast();

    int tc=1,cs=0;

    //cin>>tc;

    while(tc--)

    {

        int n,i,k,j;

        cin>>n;

        vvii v(n,vii(3)),dp(n,vii(3));

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

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

                cin>>v[i][j];

        dp[0][0]=v[0][0];

        dp[0][1]=v[0][1];

        dp[0][2]=v[0][2];

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

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

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

                {

                    if(j==k)

                        continue;

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

                }

        int ans=*max_element(all(dp[n-1]));

        cout<<ans<<nl;

    }

}