// Slower C++ solution:
#include <array>

#include <cstdlib>

#include <cmath>

#include <climits>

#include <cfloat>

#include <map>

#include <utility>

#include <set>

#include <iostream>

#include <memory>

#include <string>

#include <vector>

#include <algorithm>

#include <functional>

#include <sstream>

#include <deque>

#include <complex>

#include <stack>

#include <queue>

#include <cstdio>

#include <cctype>

#include <cstring>

#include <ctime>

#include <iterator>

#include <bitset>

#include <numeric>

#include <list>

#include <iomanip>

#include <tuple>

using namespace std;





typedef long long LL;

typedef pair<int,int> pii;

typedef pair<LL,LL> pll;



typedef vector<int> vint;

typedef vector<vector<int> > vvint;

typedef vector<long long> vll, vLL;

typedef vector<vector<long long> > vvll, vvLL;



#define VV(T) vector<vector< T > >



template <class T>

void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){

	v.assign(a, vector<T>(b, t));

}



template <class F, class T>

void convert(const F &f, T &t){

	stringstream ss;

	ss << f;

	ss >> t;

}



template <class T>

T clampMax(const T& a, const T& b) { return min(a, b); }



template <class T>

T clampMin(const T& a, const T& b) { return max(a, b); }



template <class T>

bool updateMax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }



template <class T>

bool updateMin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }



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

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

#define RALL(v) (v).rbegin(),(v).rend()

#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define PB push





#define MOD 1000000007LL

#define EPS 1e-10



const int MAX_N = 100010;

int N;

int h[3][MAX_N];

int dp[3][MAX_N];



int main()

{

    cin >> N;

    REP(i, N) cin >> h[0][i] >> h[1][i] >> h[2][i];



    REP(action, 3) REP(day, MAX_N) dp[action][day] = 0;

    REP(action, 3) dp[action][0] = h[action][0];

    REP(day, N)

    {

        if (day == 0) continue;

        REP(action, 3)

        {

            REP(prevAction, 3)

            {

                if (action != prevAction)

                {

                    updateMax(dp[action][day], h[action][day] + dp[prevAction][day - 1]);

                }

            }

        }

    }

    int ans = 0;

    REP(action, 3) updateMax(ans, dp[action][N - 1]);

    cout << ans << endl;

    return 0;

}

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

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

#define rrep(i,a,b) for(int i=a;i>=b;i--)

#define fore(i,a) for(auto &i:a)

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

//#pragma GCC optimize ("-O3")

using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }

typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

//------------------------------------------------------------------------------

//------------------------------------------------------------------------------

int dp[100010][3];



void _main()

{

    int N;

    cin >> N;

    rep(i, 0, N)

    {

        array<int, 3> h;

        cin >> h[0] >> h[1] >> h[2];

        rep(j, 0, 3)

        {

            dp[i + 1][j] = max(dp[i][(j + 1) % 3], dp[i][(j + 2) % 3]) + h[j];

        }

    }

    cout << max({dp[N][0], dp[N][1], dp[N][2]}) << endl;

}