#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<cstring>
#include<stack>
#include<queue>
#include<tuple>
#include<map>
#include <numeric>

using namespace std;
#define etm cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define pii pair<int , int>
#define pdd pair<double , double>
#define pll pair<ll,ll>
#define vpl vector<pll>
#define vll vector<ll>
#define vb vector<bool>
#define vvbb vector<vb>
#define vs vector<string>
#define mi map<int, int>
#define mull map<ull, ull>
#define stp setprecision(20)

#define fo(i,start,end) for(ll i=start;start<end?i<end:i>end;start<end?i+=1:i-=1)
#define MOD 1000000007
#define ld long double
#define inf 1e18
#define mp  make_pair
#define vpll vector<pair<ll,ll>>
#define vvpll vector<vector<pair<ll,ll>>>
#define vvll vector<vector<ll>>
#define all(x) x.begin(),x.end()
#define allb(x) x.rbegin(),x.rend()
#define fi first
#define se second
#define test ll T;cin>>T;while(T--)
#define show(w,size) for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define umll unordered_map<ll,ll>
#define mll   map<ll,ll>
#define countbit __builtin_popcount // Number of set bits .
#define in insert
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
ll gcd(ll a,ll b){if(a<b)return gcd(b,a);else if(b==0)return a;else return gcd(b,a%b);}
ll isPrime(ll n){ll p=(ll)sqrt(n);fo(i,2,p+1) if(n%i==0) return 0;return 1;}// return 1 if prime
ll pow(ll b,ll e){if(e==0)return 1;else if(e%2==0){ll a=pow(b,e/2);return a*a;}else {ll a=pow(b,e/2);return b*a*a;}}
ll pow_m(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m) { return pow_m(a, m-2, m);}
ll max(ll a,ll b){if(a>=b)return a;else return b;}
ll min(ll a,ll b){if(a<=b)return a;else return b;}
/*
const ll N=1000;
ll n,m,x,y;
char g[N+1][N+1];
ll b[N+5],w[N+5];
ll dp[N+5][2];

int main(){
    fastio;
    cin>>n>>m>>x>>y;
    fo(i,0,n){
        fo(j,0,m){
            cin>>g[i][j];
        }
    }
    fo(i,0,m){
        fo(j,0,n){
            if(g[j][i]=='.')w[i+1]++;
            else b[i+1]++;
        }
    }
    fo(i,1,m+1){
        b[i]+=b[i-1];
        w[i]+=w[i-1];
    }
    fo(i,1,m+1)dp[i][0]=dp[i][1]=1e9;
    fo(i,1,m+1){
        fo(j,x,y+1){
            ll r=i;
            ll l=i-j+1ll;
            if(l<1)continue;
            dp[i][0]=min(dp[i][0],b[r]-b[l-1]+dp[l-1][1]);
            dp[i][1]=min(dp[i][1],w[r]-w[l-1]+dp[l-1][0]);
        }
    }
    cout<<min(dp[m][0],dp[m][1])<<endl;
    return 0;
}

*/
/*
void solve() {
    ll n;
    cin>>n;
    vll v(n),dp(n+1,0);
    fo(i,0,n){
        cin>>v[i];
        dp[v[i]]=i;
    }
    string ans="1";
    ll l=dp[1],r=dp[1];
    fo(i,2,n+1){
        if(dp[i]==l-1&&r-dp[i]+1==i){
            l--;
            ans+="1";
        }
        else if(dp[i]==r+1&&dp[i]-l+1==i){
            r++;
            ans+="1";
        }
        else if(dp[i]>=l&&dp[i]<=r&&r-l+1==i){
            ans+="1";
        }
        else{
            ans+="0";
            l=min(l,dp[i]);
            r=max(r,dp[i]);
        }
    }
    cout<<ans<<endl;
}
*/

/*
int main(){
    fastio;
    ll r,c;
    cin>>r>>c;
    ll ans[r][c],count=2;
    if(r==1&&c==1)cout<<"0"<<endl;
    else if(r==1||c==1){
        if(r==1){
            fo(i,0,c)cout<<i+2<<" ";
            cout<<endl;
        }
        else{
            fo(i,0,r)cout<<i+2<<" ";
            cout<<endl;
        }
    }
    else{
        fo(i,0,c){
            ans[0][i]=count;
            count++;
        }
        fo(i,1,r){
            ll k=count;
            fo(j,0,c){
                ans[i][j]=k*(j+2);
            }
            count++;
        }
        fo(i,0,r){
            fo(j,0,c){
                cout<<ans[i][j]<<" ";
            }
            cout<<endl;
        }
    }
    return 0;
}
 */

/*
int main(){
    fastio;
    ll n,k;
    cin>>n>>k;
    vll v(n);
    fo(i,0,n)cin>>v[i];
    vll dp(n,inf);
    dp[0]=0;
    fo(i,0,n){
        fo(j,i+1,i+k+1){
            if(j<n)dp[j]=min(dp[j],dp[i]+abs(v[i]-v[j]));
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}
 */

int main(){
    fastio;
    ll n;
    cin>>n;
    vll dp(3);
    fo(i,0,n){
        vll new_dp(3,0);
        ll c[3];
        fo(j,0,3)cin>>c[j];
        fo(k,0,3){
            fo(l,0,3){
                if(k!=l)new_dp[l]=max(new_dp[l],dp[k]+c[l]);
            }
        }
        dp=new_dp;
    }
    cout<<max(dp[0],max(dp[1],dp[2]))<<endl;
    return 0;
}

Measured memory_bytes: 3612