// Original C++ solution (slower):
//**KEEP IT SHORT AND SIMPLE**



#include <bits/stdc++.h>

#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

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

#define NL '\n'

#define F first

#define S second

using namespace std;

typedef long long ll;

typedef bool bl;

typedef vector < vector<long long> > vvl;

typedef vector <long long> vll;

typedef pair <long long, long long> pll;

typedef set <long long> sll;

typedef map <long long, long long> mll;

typedef map <long long, bool> mlb;

typedef priority_queue<long long, vector<long long>, greater<long long> > minPq;

double pi = 2 * acos(0.0);

int OO = 0x3f3f3f3f;

long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }

long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }

const int NMAX = 100010;

ll n, A[NMAX], B[NMAX], C[NMAX], dp[NMAX][5];

ll solve(ll i, int last)

{

    if(i == n)          return 0;

    if(~dp[i][last])    return dp[i][last];

    ll ans = 0;

    if(last == 0)       ans = max(solve(i + 1, 1) + B[i], solve(i + 1, 2) + C[i]);

    else if(last == 1)  ans = max(solve(i + 1, 0) + A[i], solve(i + 1, 2) + C[i]);

    else if(last == 2)  ans = max(solve(i + 1, 0) + A[i], solve(i + 1, 1) + B[i]);

    else                ans = max(solve(i + 1, 0) + A[i], max(solve(i + 1, 1) + B[i], solve(i + 1, 2) + C[i]));

    return dp[i][last] = ans;

}

int main()

{

    IO

    cin >> n;

    REP(i, 0, n)

        cin >> A[i] >> B[i] >> C[i];

    memset(dp, -1, sizeof dp);

    cout << solve(0, 3);

    return 0;

}


// Optimized solution to the same problem (faster):
//**KEEP IT SHORT AND SIMPLE**



#include <bits/stdc++.h>

#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

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

#define NL '\n'

#define F first

#define S second

#define dot(a, b) (conj(a) * (b)).real()

#define cross(a, b) (conj(a)* (b)).imag()

using namespace std;

typedef long long ll;

typedef long double ld;

typedef bool bl;

typedef vector < vector<long long> > vvl;

typedef vector <long long> vll;

typedef pair <long long, long long> pll;

typedef map <long long, long long> mll;

typedef map <long long, bool> mlb;

typedef priority_queue<long long, vector<long long>, greater<long long> > minPq;

typedef tuple<ll, ll, ll> line;

typedef complex<double> point;

const double pi = 2 * acos(0.0);

const int OO = 0x3f3f3f3f;

ll ans[100005][5];

int main()

{

    IO

    ll n, Max = 0;

    cin >> n;

    ll arr[n][3];

    REP(i, 0, n)

        REP(j, 0, 3)

            cin >> arr[i][j];

    REP(i, 0, 3)

        ans[0][i] = arr[0][i];

    REP(i, 1, n)

    {

        ans[i][0] = max(ans[i - 1][1], ans[i - 1][2]) + arr[i][0];

        ans[i][1] = max(ans[i - 1][0], ans[i - 1][2]) + arr[i][1];

        ans[i][2] = max(ans[i - 1][0], ans[i - 1][1]) + arr[i][2];

    }

    REP(i, 0, 3)    Max = max(Max, ans[n - 1][i]);

    cout << Max;

    return 0;

}


// Fastest known solution for this problem: