// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

#include <unordered_map>

#define stop(x) {cout<<x<<endl;exit(0);}

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

#define szz(s) int(s.size())

#define endl '\n'

int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };

int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };

typedef long long ll;

using namespace std;



void file() {

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE

    if (freopen("input.txt", "r", stdin));

    if (freopen("output.txt", "w", stdout));

#endif

}





ll n;

ll mem[100004][4];

vector < vector < int > > v;



ll solve(int idx , int last) {

    if (idx == n)return 0;



    ll& ret = mem[idx][last];

    if (~ret)return ret;

    ret = 0;

    if (last != 0)ret = max(ret, solve(idx + 1, 0) + v[idx][0]);

    if (last != 1)ret = max(ret, solve(idx + 1, 1) + v[idx][1]);

    if (last != 2)ret = max(ret, solve(idx + 1, 2) + v[idx][2]);

    return ret;

}



int main() {

    //file();



    memset(mem, -1, sizeof mem);

    cin >> n;

    v = vector < vector < int > >(n, vector < int >(3));

    for (auto& e : v)

        for (auto& f : e)

            cin >> f;



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



}

// Faster C++ solution for the same problem (measured speedup: 4.185820141916321x):
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define rep(i, a, n) for (long long i = a; i <= n; ++i)

#define per(i, a, n) for (long long i = n; i >= a; --i)

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

template <typename T>

void read(T &x) {

    x = 0;

    char ch = getchar();

    ll f = 1;

    while (!isdigit(ch)) {

        if (ch == '-') f *= -1;

        ch = getchar();

    }

    while (isdigit(ch)) {

        x = x * 10 + ch - 48;

        ch = getchar();

    }

    x *= f;

}

using namespace std;

/*

 *                                                     __----~~~~~~~~~~~------___

 *                                    .  .   ~~//====......          __--~ ~~

 *                    -.            \_|//     |||\\  ~~~~~~::::... /~

 *                 ___-==_       _-~o~  \/    |||  \\            _/~~-

 *         __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~

 *     _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /

 *   .~       .~       |   \\ -_    /  /-   /   ||      \   /

 *  /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /

 *  |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\

 *           '         ~-|      /|    |-~\~~       __--~~

 *                       |-~~-_/ |    |   ~\_   _-~            /\

 *                            /  \     \__   \/~                \__

 *                        _--~ _/ | .-~~____--~-/                  ~~==.

 *                       ((->/~   '.|||' -_|    ~~-/ ,              . _||

 *                                  -_     ~\      ~~---l__i__i__i--~~_/

 *                                  _-~-__   ~)  \--______________--~~

 *                                //.-~~~-~_--~- |-------~~~~~~~~

 *                                       //.-~~~--\

 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 */



#pragma endregion

const int maxn = 1e5 + 5;

int a[maxn], b[maxn], c[maxn], dp[maxn][3];

int main() {

    IO;

    int n;

    cin >> n;

    rep(i, 1, n) cin >> a[i] >> b[i] >> c[i];

    rep(i, 1, n) {

        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];

        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];

        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];

    }

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

}