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

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

#define     FasterIO        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define     bug(a,b)        cout<<a<<"\t"<<b<<"\n";

#define     Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";

#define     watch(a)        cout<<fixed<<setprecision(a)

#define     lp(i,a,b)       for(int i=a;i<b;i++)

#define     Endl            "\n";

#define     tab             "\t"

#define     reset(a,b)      memset(a,b,sizeof(a));

#define     sf(a)           scanf(" %d", &a);

#define     srt(a)          sort(a.begin(),a.end());

#define     pi              2*acos(0.0)

#define     inf             INT_MAX

const int sz=1e5+9;

int n,x,arr[sz][3],dp[sz][3];



int clac(int i,int ignore ,int value){

    if(i>n)return value;

    if(dp[i][ignore]!=-1)return dp[i][ignore];

    int ret=0;

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

        if(j==ignore)

            continue;

        ret=max(ret,value+clac(i+1,j,arr[i][j]));

    }

    return dp[i][ignore]=ret;

}



void solve(){

    cin>>n;

    reset(dp,-1);

    //cout<<dp[2][0]<<tab<<dp[2][1]<<tab<<dp[2][2]<<endl;

    lp(i,1,n+1)cin>>arr[i][0]>>arr[i][1]>>arr[i][2];

    int ans1=clac(2,0,arr[1][0]);

    //cout<<dp[2][0]<<tab<<dp[2][1]<<tab<<dp[2][2]<<endl;

    int ans2=clac(2,1,arr[1][1]);

    int ans3=clac(2,2,arr[1][2]);

    //cout<<ans1<<tab<<ans2<<tab<<ans3<<endl;

    //int ans=max(ans1,(max(ans2,ans3)));

   // bug(ans1,1);

    cout<<max(ans1,(max(ans2,ans3)))<<"\n";

}



int main(){

    //FasterIO;

    #ifndef ONLINE_JUDGE

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

    #endif

    // int t;

    //cin>>t;

    //while(t--)

        solve();

}


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

using namespace std;



#define ff              first

#define ss              second

#define ll             long long

#define pb              push_back

#define mp              make_pair

#define pii             pair<ll,ll>

#define vi              vector<ll>

#define mii             map<ll,ll>

#define pqb             priority_queue<ll>

#define pqs             priority_queue<ll,vi,greater<ll> >

#define setbits(x)      __builtin_popcountll(x)

#define zrobits(x)      __builtin_ctzll(x)

#define mod             1000000007

#define inf             1e18

#define ps(x,y)         fixed<<setprecision(y)<<x

#define mk(arr,n,type)  type *arr=new type[n];

#define w(x)            ll x; cin>>x; while(x--)

#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)



struct activity{

ll A,B,C;};



ll solve(ll n,vector<activity>v){

    ll dp[n+1][3];

dp[1][0]=v[1].A;

dp[1][1]=v[1].B;

dp[1][2]=v[1].C;

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

{

    dp[i][0]=v[i].A+max(dp[i-1][1],dp[i-1][2]);

    dp[i][1]=v[i].B+max(dp[i-1][0],dp[i-1][2]);

    dp[i][2]=v[i].C+max(dp[i-1][1],dp[i-1][0]);

}



return max(dp[n][0],max(dp[n][1],dp[n][2]));



}



int main()

{

    FIO;

    ll a,b,c,d,e,f=0,sum=0,ans,ck=0,m,n,k,p,q,r,t,add=0,x,y,z;



    string s;



    cin>>n;

    vector<activity>v(n+1);

    for(int i=1;i<=n;i++){cin>>v[i].A;cin>>v[i].B;cin>>v[i].C;}

    ans=solve(n,v);

    cout<<ans<<endl;







    return 0;

}