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

using namespace std;

typedef long long ll;



ll arr[100009][3];

int dp[100009][2][2][2];



long long VAC1(int n,int a, int b, int c)

{



    if(!n && a) return arr[n][0];

    else if(!n && b) return arr[n][1];

    else if(!n && c) return arr[n][2];

    else if(dp[n][a][b][c]!=-1)return dp[n][a][b][c];



    else

    {



        ll x,y,z;

        if(a)

        {

            x = VAC1(n-1,0,1,0)+arr[n][0];

            y = VAC1(n-1,0,0,1)+arr[n][0];



        }



        else if(b)

        {

            x = VAC1(n-1,1,0,0)+arr[n][1];

            y = VAC1(n-1,0,0,1)+arr[n][1];

        }



        else if(c)

        {

            x = VAC1(n-1,1,0,0)+arr[n][2];

            y = VAC1(n-1,0,1,0)+arr[n][2];

        }



        dp[n][a][b][c] = max(x,y);;

        return dp[n][a][b][c];





    }

}



int main()

{

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

    int n;

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

    cin >> n;

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

    {

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

        {

            cin >> arr[i][j];

        }

    }

    ll res = VAC1(n-1,1,0,0);

    res= max(res, VAC1(n-1,0,1,0));

    res = max(res,VAC1(n-1,0,0,1));



    cout << res << endl;

}


// Faster C++ solution for the same problem (measured speedup: 4.160631816029044x):
#include <iostream>

#include <bits/stdc++.h>

#define mod 998244353

typedef long long ll;



using namespace std;



void Fastio(){

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}



ll fact[1000006], inv[1000006];



ll fp(ll base, ll exp)

{

    if (exp == 0)

        return 1;

    ll ans = fp(base, exp / 2);

    ans = (ans * ans) % mod;

    if (exp % 2 != 0)

        ans = (ans * (base % mod)) % mod;

    return ans;

}



void calcFacAndInv(ll n)

{

    fact[0] = inv[0] = 1;

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

    {

        fact[i] = (i * fact[i - 1]) ;

        inv[i] = fp(fact[i], mod - 2);

    }

}



ll ncr(ll n, ll r)

{

    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;

}



ll npr(ll n, ll r)

{

    return (fact[n] * inv[n - r]) % mod;

}



long double  NCR(int n, int m){

    long double res = 1;

    m = min(m, n - m);

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

        res = res * ( n - i) / (i + 1);

 }

    return res;

}

ll tol(string a){

    ll res=0;

    while(a[0]=='0'){

        a.erase(a.begin());

    }

    if(a=="")a="0";

    for(int i=0; i<a.size(); i++){

        res*=10; res+=a[i]-'0';

    }

    return res;

}

int check(string a, string b){

    for(int i=0; i<a.size(); i++){

        if(a[i]>b[i])return 1;

        if(b[i]>a[i])return -1;

    }

    return 0;

}

class data{

public:

    ll v,d,p;

    data(){}

    data(ll vv, ll dd, ll pp){

        v=vv;  d=dd; p=pp;

    }

};



int primeFactors(int n)

{

    ll c=0;

    while (n % 2 == 0)

    {

        c++;

        n = n/2;

    }

    for (int i = 3; i*i <= n; i = i + 2)

    {

        while (n % i == 0)

        {

            c++;

            n = n/i;

        }

    }

    if (n > 2)

        c++;

    return c;

}



int main()

{

    Fastio();

    int n; cin>>n;

    ll a[n],b[n],c[n];

    ll dp[n+1][5];

    memset(dp,0,sizeof(dp));

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

        cin>>a[i]>>b[i]>>c[i];

    }

    for(int i=n-1; i>=0; i--){

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

            ll res1,res2,res0;

            res0=res1=res2=-1e9;

            res0=dp[i+1][0]+a[i];

            res1=dp[i+1][1]+b[i];

            res2=dp[i+1][2]+c[i];

            if(y==0){

                dp[i][y]=max(res1,res2);

            }

            if(y==1){

                dp[i][y]=max(res0,res2);

            }

            if(y==2){

                dp[i][y]=max(res0,res1);

            }

        }

    }

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





    return 0;

}