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

#define p5 100005

using namespace std;



int dp[p5][4],a[p5][4];

int n;



int solve(int day,int state)

{

    if(day==n) return a[day][state];

    if(dp[day][state]!=-1) return dp[day][state];

    int cost=a[day][state];

    if(state==1) cost+=max(solve(day+1,2),solve(day+1,3));

    else if(state==2) cost+=max(solve(day+1,1),solve(day+1,3));

    else if(state==3) cost+=max(solve(day+1,1),solve(day+1,2));

    else cost=max( solve(day+1,1), max(solve(day+1,2),solve(day+1,3)) );



    return dp[day][state]=cost;

}



int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++) scanf("%d %d %d",&a[i][1],&a[i][2],&a[i][3]);

    memset(dp,-1,sizeof(dp));

    printf("%d\n",solve(0,0));



    return 0;

}


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

#include <bits/stdc++.h>

#define mod 998244353

typedef long long ll;



using namespace std;



void Fastio(){

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}



ll fact[1000006], inv[1000006];



ll fp(ll base, ll exp)

{

    if (exp == 0)

        return 1;

    ll ans = fp(base, exp / 2);

    ans = (ans * ans) % mod;

    if (exp % 2 != 0)

        ans = (ans * (base % mod)) % mod;

    return ans;

}



void calcFacAndInv(ll n)

{

    fact[0] = inv[0] = 1;

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

    {

        fact[i] = (i * fact[i - 1]) ;

        inv[i] = fp(fact[i], mod - 2);

    }

}



ll ncr(ll n, ll r)

{

    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;

}



ll npr(ll n, ll r)

{

    return (fact[n] * inv[n - r]) % mod;

}



long double  NCR(int n, int m){

    long double res = 1;

    m = min(m, n - m);

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

        res = res * ( n - i) / (i + 1);

 }

    return res;

}

ll tol(string a){

    ll res=0;

    while(a[0]=='0'){

        a.erase(a.begin());

    }

    if(a=="")a="0";

    for(int i=0; i<a.size(); i++){

        res*=10; res+=a[i]-'0';

    }

    return res;

}

int check(string a, string b){

    for(int i=0; i<a.size(); i++){

        if(a[i]>b[i])return 1;

        if(b[i]>a[i])return -1;

    }

    return 0;

}

class data{

public:

    ll v,d,p;

    data(){}

    data(ll vv, ll dd, ll pp){

        v=vv;  d=dd; p=pp;

    }

};



int primeFactors(int n)

{

    ll c=0;

    while (n % 2 == 0)

    {

        c++;

        n = n/2;

    }

    for (int i = 3; i*i <= n; i = i + 2)

    {

        while (n % i == 0)

        {

            c++;

            n = n/i;

        }

    }

    if (n > 2)

        c++;

    return c;

}



int main()

{

    Fastio();

    int n; cin>>n;

    ll a[n],b[n],c[n];

    ll dp[n+1][5];

    memset(dp,0,sizeof(dp));

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

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

    }

    for(int i=n-1; i>=0; i--){

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

            ll res1,res2,res0;

            res0=res1=res2=-1e9;

            res0=dp[i+1][0]+a[i];

            res1=dp[i+1][1]+b[i];

            res2=dp[i+1][2]+c[i];

            if(y==0){

                dp[i][y]=max(res1,res2);

            }

            if(y==1){

                dp[i][y]=max(res0,res2);

            }

            if(y==2){

                dp[i][y]=max(res0,res1);

            }

        }

    }

    cout<<max(dp[0][0],max(dp[0][1],dp[0][2]))<<'\n';





    return 0;

}