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

#include <string>

#include <cstdlib>

using namespace std;



#define READ                freopen("in.txt", "r", stdin)

#define WRITE               freopen("out.txt", "w", stdout)



#define si(a)               scanf("%d", &a)

#define sii(a,b)            scanf("%d %d", &a, &b)

#define siii(a,b,c)         scanf("%d %d %d", &a, &b, &c)



#define CLR(a)              memset(a, 0, sizeof(a))

#define SET(a)              memset(a, -1, sizeof(a))



#define PI                  acos(-1.0)



#define pb                  push_back

#define mp                  make_pair

#define SORT(v)             sort(v.begin(), v.end())

#define REV(v)              reverse(v.begin(), v.end())

#define FOR(i, n)           for(int i=0; i<n; i++)

#define FOR1(i, n)          for(int i=1; i<=n; i++)

#define ROF(i, n)           for(int i=n-1; i>=0; i--)

#define ROF1(i, n)          for(int i=n; i>=1; i--)

#define LOOP(i, x, y)       for(int i=x; i<=y; i++)

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





typedef long long              LL;

typedef unsigned long long     ULL;

typedef vector<int>            VI;

typedef pair<int, int>         PII;

typedef pair<string, int>      PSI;

typedef pair<char, int>        PCI;



const int MAX = 100005;

const LL LMAX = 12158598925;

const double eps = 1e-9;

const int INF = 0x3f3f3f3f;



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

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

int kx[] = {1, 1, 2, 2, -1, -1, -2, -2};

int ky[] = {2, -2, 1, -1, 2, -2, 1, -1};



int n, w;

int arr[MAX][3];

LL dp[MAX][3];







int main()

{

//    READ;

//    WRITE;

    si(n);



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

        for(int j=0; j<3; j++)

            si(arr[i][j]);

    }



    for(int j=0; j<3; j++) dp[1][j] = arr[1][j];



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

//        cout << "FOR: " << i << ":\n";

        for(int j=0; j<3; j++){

            LL mx = INT_MIN;

            for(int q=0; q<3; q++){

                if(q == j) continue;



                mx = max(mx, dp[i-1][q]);

            }



            dp[i][j] = arr[i][j] + mx;

//              cout << " max: " << mx << " arr: " << arr[i][j] << " dp: " << dp[i][j] << endl;

        }

//        cout << endl;

    }



//    cout << endl;

//    for(int i=1; i<=n; i++){

//        for(int j=0; j<3; j++){

//            cout << dp[i][j] << " ";

//        }

//        cout << endl;

//    }



    LL ans = INT_MIN;

    for(int j=0; j<3; j++) ans = max(ans, dp[n][j]);



    cout << ans << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.153930338707493x):
#include<cstdio>

#include<algorithm>



using namespace std;



const int maxn = 1e5 + 5;

int dp[maxn][5],a[maxn][4];

int main()

{

	int n,i,j;

	scanf("%d",&n);

	for(i=1;i<=n;i++)

	{

		for(j=1;j<=3;j++)

		{

			scanf("%d",&a[i][j]);

		}

	}

	for(i=1;i<=3;i++)

		dp[1][i]=a[1][i];

	for(i=2;i<=n;i++)

	{

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

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

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

	}

	int ans=0;

	for(i=1;i<=3;i++)

		ans=max(dp[n][i],ans);

		printf("%d\n",ans);

}