#include <bits/stdc++.h>
using namespace std;
 
#define     all(x) x.begin(),x.end()
#define     ff first
#define     ss second
#define     ll long long
#define     ld long double
#define     pb push_back
#define     endl "\n"
#define     MOD 1000000007
#define     N 1000005 
#define     INF 1e18
#define     mod 998244353
#define     REP(i,n) for(ll i=0;i<(n);i++)
#define     FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define     FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define     BLOCK 555
mt19937     rng(chrono::steady_clock::now().time_since_epoch().count());

typedef     vector <ll> vll;
typedef     vector <pair<ll,ll>> vp;
typedef     vector<vector<ll> >vvll;


/*      author:- Indrajit Sen
        Institution:- Jalpaiguri Government Engineering College
        id:- @Is97, @indra1997
                                                                */
                                                                

                                                            


// log(y) power calculation
ll power_mod(ll x, ll y, ll m){
    ll arr = 1;
    x%=m;
    while(y){
        if(y&1){
            arr=(arr*x)%m;
        }
        y>>=1;
        x=(x*x)%m;
    }
    return arr;
}

ll power(ll x, ll y){
    ll arr = 1;
    while(y){
        if(y&1){
            arr*=x;
        }
        y>>=1;
        x = x*x;
    }
    return arr;
}


ll mod_inv(ll x,ll m){
    return power_mod(x,m-2,m);
}

int randomGenerator(int limit){ 
    
        random_device rd; 
        mt19937 gen(rd()); 
        uniform_int_distribution<> dis(1, limit);

    return dis(gen);
}

// customized hash function for lowering the collision in UNORDERED_MAP
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
       
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
 

bool comp(const pair<ll,pair<ll,ll>> &a, const pair<ll,pair<ll,ll>> &b) { 
    if(a.ff == b.ff){

        return (a.second < b.second); 
    }
    return (a.ff < b.ff); 
} 

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

bool isPalindrome(string s){
    bool flag = true;
    for(int i=0;i<s.length()/2;i++){
        if(s[i]!=s[s.length()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}

// vll adj[200001];
ll n;
vll a(100005),b(100005),c(100005);
ll dp[100005][4];
ll recur(ll index, ll prev){
    if(index==n+1){
        return 0;
    }
    ll &ans = dp[index][prev];
    if(ans!=0){
        return ans;
    }
    if(prev==0){
        ans = ans+max(a[index]+recur(index+1,1),max(b[index]+recur(index+1,2),c[index]+recur(index+1,3)));
    }
    else if(prev==1){
        ans = ans + max(b[index] + recur(index+1,2),c[index] + recur(index+1,3));
    }
    else if(prev==2){
        ans = ans + max(a[index] + recur(index+1,1),c[index] + recur(index+1,3));
    }
    else if(prev==3){
        ans = ans + max(a[index] + recur(index+1,1),b[index] + recur(index+1,2));
    }
    return ans;
}


void solve(){
    
    cin>>n;
    FOR(i,1,n){
        cin>>a[i]>>b[i]>>c[i];
    }
    memset(dp,0,sizeof(dp));
    ll ans = recur(1,0);
    cout<<ans<<endl;
}


int main(){
    
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);

    // ll t;
    // cin>>t;
    // FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    // }
    return 0;
}


Measured memory_bytes: 10368