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

 

#define pb push_back

#define fst first

#define snd second

#define INF 0x7fffffff

#define INFLL 0x7FFFFFFFFFFFFFFF

#define lenA(ar) sizeof(ar)/sizeof(*ar)

#define lenrows(mat) sizeof(mat)/sizeof(*mat)

#define lencols(mat) sizeof(*mat)/sizeof(**mat)

#define fill(a,c) memset(&a, c, sizeof(a))

#define fore(i,x,y) for(ll i=x;i<y;i++)

#define foreI(i,x,y) for(ll i=x-1;i>=y;i--)

#define max2(a,b) max(a, b)

#define max3(a,b,c) max2(max2(a,b),c)

#define min2(a,b) min(a, b)

#define min3(a,b,c) min2(min2(a,b),c)

#define MOD 1000000009

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

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

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

 

typedef long long ll;

typedef unsigned long long ull;

 

using namespace std;

ll arr[100010][3];

ll dp[100010][3];

int n;

ll solve(int i, int j){

    if(i==n-1) return arr[i][j];

    ll &r = dp[i][j];

    if(r>-1) return r;

    ll a = 0; ll b = 0;ll c = 0; ll act=arr[i][j];

    if(j!=0) a=solve(i+1, 0)+act;

    if(j!=1) b=solve(i+1, 1)+act;

    if(j!=2) c=solve(i+1, 2)+act;

   return r=max3(a,b,c);

}

 

int main() {

     

    cin>>n;

    arr[n][3];

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

    fore(i,0,n){

        fore(j,0,3){

            cin>>arr[i][j];

        }

    }

 

    cout<<max3(solve(0,0),solve(0,1),solve(0,2))<<"\n";

 

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.363839446786283x):
//I solved it before. If I had enough time I wouldn't have submitted old codes.

//If you forbid I won't do this in the upcoming contests

#include <iostream>

#include <vector>

#include <cmath>

#include <set>

#include <queue>

#include <map>

#include <cstdio>

#include <cstring>

#include <string>

#include <stack>

#include <algorithm>

#include <limits.h>

#include <bits/stdc++.h>

#define fw(x) freopen("x.txt","w",stdout)

#define For(i,a,b,c) for(int i = a;i < b;i+=c)

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

#define REP1(i,n) for(int i = 1; i<=n;i++)

#define mem(a,s) memset(a,s,sizeof a)

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

#define pf printf

#define sc scanf

#define ll long long

#define pii pair<int,int>

#define pll pair<ll,ll>

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

#define vii vector<int>

#define vll vector<ll>

#define vss vector<string>

#define debug(x)  cout<<#x"="<<(x)<<endl

#define pb push_back





using namespace std;





// moves



//int dx[]= {0,0,1,-1};/*4 side move*/

//int dy[]= {-1,1,0,0};/*4 side move*/

//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/

//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/

//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/

//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/





//big_mod



//ll bigmod(ll a,ll b,ll m)

//{if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a)% m;return x;}

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



//ll getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1ll;}

//ll setBit1(ll num, int idx) {return num or (1ll<<idx);}

//ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}

//ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}



const int mod = 1000000007;

ll qpow(ll n,ll k)

{

    ll ans=1;

    assert(k>=0);

    n%=mod;

    while(k>0)

    {

        if(k&1)

            ans=(ans*n)%mod;

        n=(n*n)%mod;

        k>>=1;

    }

    return ans%mod;

}

int ar[100009][3];

int sum[100009][3];

void run(int i, int pre, int n){

    if(i>=n) return;

    int sum1=0, sum2=0, sum3=0;

    if(pre!=0){

        if(sum[i+1][0] == -1 ) run(i+1, 0, n);

        sum1 = ar[i][pre] + sum[i+1][0];

    }

    if(pre!=1){

        if(sum[i+1][1] == -1 ) run(i+1, 1, n);

        sum2 = ar[i][pre] + sum[i+1][1];

    }

    if(pre!=2){

        if(sum[i+1][2] == -1 ) run(i+1, 2, n);

        sum3 = ar[i][pre] + sum[i+1][2];

    }

    sum[i][pre] = max(sum1, max(sum2, sum3));

}

int main()

{

    fast;

    int n, a, b, c;

    cin>>n;

    REP1(i, n){

        cin>>a>>b>>c;

        sum[i][0]= -1;

        sum[i][1]= -1;

        sum[i][2]= -1;

        ar[i][0] = a;

        ar[i][1] = b;

        ar[i][2] = c;

    }

    sum[n][0] = ar[n][0];

    sum[n][1] = ar[n][1];

    sum[n][2] = ar[n][2];

    run(1, 0, n);

    run(1, 1, n);

    run(1, 2, n);

    cout<< max(sum[1][0], max(sum[1][1], sum[1][2]) ) <<'\n';

    return 0;

}