// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>



#define rep(i,x,n) for(int i=x;i<n;i++)

#define repd(i,x,n) for(int i=x;i<=n;i++)

#define pii pair<int,int>

#define pll pair<long long ,long long>

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

#define MS0(X) memset((X), 0, sizeof((X)))

#define MSC0(X) memset((X), '\0', sizeof((X)))

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define gg(x) getInt(&x)



using namespace std;



typedef long long ll;

inline void getInt(int* p);

const int maxn=1000010;

const int inf=0x3f3f3f3f;



ll n;

ll a[maxn];

ll b[maxn];

ll c[maxn];

ll dp[maxn][5];



int main()

{

    gbtb;

    cin>>n;

    repd(i,1,n)

    {

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

    }

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

    dp[1][2]=b[1];

    dp[1][3]=c[1];

    repd(i,2,n)

    {

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

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

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

    }

    cout<<max(dp[n][3],max(dp[n][1],dp[n][2]));

    return 0;

}



inline void getInt(int* p) {

    char ch;

    do {

        ch = getchar();

    } while (ch == ' ' || ch == '\n');

    if (ch == '-') {

        *p = -(getchar() - '0');

        while ((ch = getchar()) >= '0' && ch <= '9') {

            *p = *p * 10 - ch + '0';

        }

    }

    else {

        *p = ch - '0';

        while ((ch = getchar()) >= '0' && ch <= '9') {

            *p = *p * 10 + ch - '0';

        }

    }

}

// Faster C++ solution for the same problem (measured speedup: 5.250199283648287x):
#include<stdio.h>

#include<stdlib.h>



#define get(a, i, j) *((*(a+i))+j)





typedef long long ll;



//long long **mem, **util, N;

ll mem[100001][3], util[100001][3], N;



ll dp(ll d, ll u);



int main()

{

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



    ll i, max, temp_util;



    //util = (ll**) malloc(N * sizeof(ll*));

    //mem = (ll**) malloc(N * sizeof(ll*));



    scanf("%lld", &N);



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

        //*(util+i) = (ll*) malloc(3 * sizeof(ll));

        //*(mem+i) = (ll*) calloc(3, sizeof(ll));



        scanf("%lld%lld%lld", &get(util, i, 0), &get(util, i, 1), &get(util, i, 2));

    }





    //printf("%lld\n", dp(0, 0));

    max = 0;

    temp_util = 0;



    for(i = 0; i<3; ++i){

        //printf("calling dp(const 0, %lld)\n", i);

        temp_util = dp(0, i);

        if (max < temp_util) max = temp_util;

    }



    printf("%lld\n", max);



    return 0;

}





ll dp(ll d, ll u)

{

    //printf("inside dp with d = %lld, u = %lld\n", d, u);

    if (d == N-1) {

        //printf("returning %lld without setting\n\n", get(util, d, u));

        return get(util, d, u);

    }



    if(get(mem, d, u) > 0) {

        //printf("returning %lld without setting\n\n", get(util, d, u));

        return get(mem, d, u);

    }



    ll i, max, temp_util;



    max = 0;

    temp_util = 0;

    for(i = 0; i<3; ++i){

        if(i!=u) temp_util = dp(d+1, i);

        if(temp_util>max) max = temp_util;

    }



    //printf("setting value in mem[%lld][%lld] = %lld (%lld)\n\n", d, u, get(util, d, u)+max, get(util, d, u));

    return get(mem, d, u) = get(util, d, u) + max;

}