// 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.230339893294833x):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using ii = pair<int, int>;

using iii = pair<ii, int>;

#define vt vector

#define pq priority_queue

#define pb push_back

#define pf push_front

#define mp make_pair

#define fi first

#define se second

#define __lcm(a, b) a * b / __gcd(a, b)

const int MOD = 1e9 + 7;

const int INF = 2e9;

const int N = 1e5 + 5;



int n;

int a[N], b[N], c[N];

int dp[N][5];



void getDP() {

    // i = index, j = now

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

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

            int &sol = dp[i][j];

            if(j == 0) 

                sol = max(dp[i - 1][1] + a[i - 1],

                      max(dp[i - 1][2] + b[i - 1],

                          dp[i - 1][3] + c[i - 1]));

            else if(j == 1) 

                sol = max(dp[i - 1][2] + b[i - 1],

                          dp[i - 1][3] + c[i - 1]);

            else if(j == 2) 

                sol = max(dp[i - 1][1] + a[i - 1],

                          dp[i - 1][3] + c[i - 1]);

            else 

                sol = max(dp[i - 1][1] + a[i - 1],

                          dp[i - 1][2] + b[i - 1]);

        }

    }

}



void solve() {

    cin >> n;

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

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

    }

    getDP();

    cout << max(dp[n][1] + a[n], max(dp[n][2] + b[n], dp[n][3] + c[n])) << "\n";

}



int main() {

 

    ios_base::sync_with_stdio(0);

    cin.tie(0); cout.tie(0);

    

    solve();

    

}