// Original C++ solution (slower):
/**

 * @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;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<stdio.h>

#include<algorithm>

#include<vector>

#include<cstring>

#include<set>

#include<queue>

#include<map>

#include<math.h>

#include<climits>



#define FASTREAD      ios_base::sync_with_stdio(0);cin.tie(nullptr);

#define ll long long

#define dd double

#define scl(n)        scanf("%lld",&n)

#define scd(n)        scanf("%lf",&n)

#define scc(n)        scanf("%c",&n)

#define scs(n)        scanf("%s",&n)

#define ptl(n)        printf("%lld",n)

#define ptd(n)        printf("%f",n)

#define ptc(n)        printf("%c",n)

#define pts(n)        printf("%s",n)

#define nline         printf("\n")

#define pb            push_back

#define FOR(i,a,b)    for(ll i=a;i<=b;i++)

#define FORr(i,a,b)   for(ll i=a;i>=b;i--)

#define pi            2*acos(0.0)

#define pii           pair<ll,ll>

#define uu            first

#define vv            second



using namespace std;

ll n,a[100005],b[100005],c[100005],dp[100010][3],op0,op1,op2;

int main()

{

    scl(n);

    FOR(i,1,n)

    {

        scl(a[i]);

        scl(b[i]);

        scl(c[i]);

    }

    dp[n][0]=a[n];

    dp[n][1]=b[n];

    dp[n][2]=c[n];

    FORr(i,n-1,1)

    {

        if(i+1<=n)

        {

            op0=dp[i+1][0];

            op1=dp[i+1][1];

            op2=dp[i+1][2];

        }

        else

        {

            op0=LONG_MIN;

            op1=LONG_MIN;

            op2=LONG_MIN;

        }

        dp[i][0]=max(op1+a[i],op2+a[i]);

        dp[i][1]=max(op0+b[i],op2+b[i]);

        dp[i][2]=max(op0+c[i],op1+c[i]);

       // cout<<dp[i][0]<<endl;

    }

    ll ans=max(dp[1][0],dp[1][1]);

    ans=max(ans,dp[1][2]);

    ptl(ans);

    return 0;

}


// Fastest known solution for this problem: