// Slower C++ solution:
/**

 * @author      : Luis Miguel Baez <es.luismiguelbaez@gmail.com>

 * @created     : Thursday August 13, 2020

 */



#include <bits/stdc++.h>



using namespace std;



#define endl '\n'

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

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

#define ms(arr, value) memset(arr, value, sizeof arr)

#define ll    int64_t



#define pii   pair<int, int>

#define piii  tuple<int, int, int>

#define pll   pair<ll, ll>

#define plll  tuple<ll, ll, ll>



#define F  first

#define S  second



const int oo  = (int)(1e9);

const ll lloo  = (ll)(1e18);



const int N = int(1e5) + 10;



class Task {

public:



    int n;

    vector<piii> A;



    ll dp[N][4];





    ll go(int index, int last) {

        if(index > n) return 0LL;

        ll &ans = dp[index][last];

        if(ans != -1) return ans;

        ll x=0, y=0;

        if(last == 1) {

            x = get<1>(A[index]) + go(index+1, 2);

            y = get<2>(A[index]) + go(index+1, 3);

        } else if(last == 2) {

            x = get<0>(A[index]) + go(index+1, 1);

            y = get<2>(A[index]) + go(index+1, 3);

        } else if(last == 3) {

            x = get<0>(A[index]) + go(index+1, 1);

            y = get<1>(A[index]) + go(index+1, 2);

        } else {

            ll z = 0;

            x = get<0>(A[index]) + go(index+1, 1);

            y = get<1>(A[index]) + go(index+1, 2);

            z = get<2>(A[index]) + go(index+1, 3);

            x = max(x, z);

        }

        ans = max(x, y);

        return ans;

    }



    ll solveOne(istream &in, ostream &out) {

        int a, b, c;

        in >> n;

        A.resize(n+1);

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

            in >> a >> b >> c;

            A[i] = {a, b, c};

        }

        memset(dp, -1, sizeof dp);

        ll ans = go(1, -1);

        return ans;  

    }

    

    void solve(istream &in, ostream &out) {

        int t = 1;

        while(t--) {

            out << solveOne(in, out) << endl;

        }

    }

};



auto main() -> int {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    cout.tie(NULL);

    

    Task solver;

    istream &in(cin);

    ostream &out(cout);

    solver.solve(in, out);

    return 0;

}

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

#define ll long long

#define inf 9999999999999999

#define F first

#define S second

#define eb emplace_back

#define mpp make_pair

#define P(x) cout<<__LINE__ <<": "<<#x<<' '<<(x)<<'\n'

#define dbg cout<<__LINE__ <<": 0manush\n"

#define read(x) freopen("input.txt","r",stdin)

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

#define pi 2*acos(0.0)

#define ee exp(1)

#define mx 100009

#define mod 10000007

using namespace std;

int main(){//read(x);

//fast;

ll r,g,h,i,j,x,y,t,e,a,b,c,d,n,l,k;



    cin>>n;

    ll m[n+5][3],dp[n+55][3];

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

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

            cin>>m[i][j];



    dp[n][0]=dp[n][1]=dp[n][2]=0;

    l=0;

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

        dp[i][0]=max(m[i][1]+dp[i+1][1],m[i][2]+dp[i+1][2]);

        dp[i][1]=max(m[i][0]+dp[i+1][0],m[i][2]+dp[i+1][2]);

        dp[i][2]=max(m[i][1]+dp[i+1][1],m[i][0]+dp[i+1][0]);

    }

    //cout<<dp[0][0]<<' '<<dp[0][1]<<' '<<dp[0][2]<<endl;

    l=max(dp[0][0],max(dp[0][1],dp[0][2]));

    cout<<l<<endl;

}