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

#include <string.h>

#define MAXN 100003



int array_a[MAXN][3];

int array_d[MAXN][3];



int max(int a,int b){

	return a>b? a:b;

}



int main(){

	memset(array_a,-1,sizeof(int)*MAXN*3);

	memset(array_d,-1,sizeof(int)*MAXN*3);

	int N;

	scanf("%d",&N);



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

		scanf("%d %d %d",&array_a[i][0],&array_a[i][1],&array_a[i][2]);

	}



	array_d[0][0]=array_a[0][0];

	array_d[0][1]=array_a[0][1];

	array_d[0][2]=array_a[0][2];

	for(int i=1;i<N;i++){

		array_d[i][0]=array_a[i][0]+max(array_d[i-1][1],array_d[i-1][2]);

		array_d[i][1]=array_a[i][1]+max(array_d[i-1][0],array_d[i-1][2]);

		array_d[i][2]=array_a[i][2]+max(array_d[i-1][0],array_d[i-1][1]);

	}

	printf("%d",max(array_d[N-1][0],max(array_d[N-1][1],array_d[N-1][2])));

	return 0;



}

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

}