// 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[4][MAX_N];

int dp[4][MAX_N];



int Solve(int day, int prevAction)

{

    if (dp[prevAction][day] >= 0) return dp[prevAction][day];

    if (day == N) return dp[prevAction][day] = 0;

    int res = 0;

    REP(i, 3)

    {

        if (i == prevAction) continue;

        updateMax(res, h[i][day] + Solve(day + 1, i));

    }

    return dp[prevAction][day] = res;

}



int main()

{

    cin >> N;

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

    REP(i, 4) REP(j, MAX_N) dp[i][j] = -1;

    cout << Solve(0, 3) << endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.181050753337192x):
#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;

}