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

using namespace std;



int n;

int dp[100100][4];

vector<int> arr[100100];



int main() {

    cin >> n;

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

        int k;

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

            cin >> k;

            arr[i].push_back(k);

        }

    }



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



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

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



            if ( j == 0 ) 

                dp[pos][j] = arr[pos][j] + max(dp[pos - 1][1], dp[pos - 1][2]);

            

            else if ( j == 1 )

                dp[pos][j] = arr[pos][j] + max(dp[pos - 1][0], dp[pos - 1][2]);



            else

                dp[pos][j] = arr[pos][j] + max(dp[pos - 1][0], dp[pos - 1][1]);

        }

    }



    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;

    return 0;

}


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

}