// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem: