// Slower C++ solution:
#include <bits/stdc++.h>

#define inf INFINITY

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

#define Gamed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define _3102_ main()

#define endl '\n'

typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

using namespace std;

const int N = 1e5 + 100;

const ll MX = 1e9;

const ll mod = 1e9 + 7;

const double eps = 1e-9 ;



ll n, a[N] , b[N] , c[N], dp[N][3] ;



ll solve( int i , int j ){

	if ( i < 0 ) return 0 ;

	ll &ret = dp[i][j] ;

	if ( ret != -1) return ret ;

	if ( j == 0 ){

		return ret = a[i] + max ( solve(i-1 , 1), solve(i-1,2) ) ;

	}

	else if ( j == 1 ){

		return ret = b[i] + max ( solve(i-1 , 0), solve(i-1,2) ) ;

	}

	return ret = c[i] + max ( solve(i-1 , 1), solve(i-1,0) ) ;

}



int _3102_{

	Gamed

	cin >> n ;

	for ( int i = 0 ; i < n ; i ++ ) {

		cin >> a[i] >> b[i] >> c[i] ;

	}

	memset ( dp , -1 , sizeof dp);

	dp[0][0] = a[0] , dp[0][1] = b[0] , dp[0][2] = c[0] ;

	cout << max ( solve ( n - 1 , 1) , max ( solve ( n -1 , 0 ) , solve ( n - 1 , 2 ))) << endl ;

	return 0;

}


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

}