// 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.2043246514062442x):


#include<bits/stdc++.h>

using namespace std;

#define ll long long



int main()

{

        ll N;

        cin>>N;

        ll A[N]={},B[N]={},C[N]={};

        ll i,j,k;



      ll  bal[N][3]={};





        for(i=0;i<N;i++){

                        cin>>A[i]>>B[i]>>C[i];



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

                                if(i==0){

                                        if(j==0)bal[i][0]=bal[i][0]+A[i];

                                        else if(j==1)bal[i][1]=bal[i][1]+B[i];

                                        else bal[i][2]=bal[i][2]+C[i];

                                }

                                else {

                                        for(k=0;k<3;k++){

                                                if(j==k)continue;

                                                else if(j==0){

                                                            bal[i][j]=max(bal[i][j],bal[i-1][k]+A[i]);

                                                                }

                                                else if(j==1){

                                                          bal[i][j]=max(bal[i][j],bal[i-1][k]+B[i]);

                                                }

                                                else{

                                                        bal[i][j]=max(bal[i][j],bal[i-1][k]+C[i]);

                                                }

                                        }

                                }

                }

        }

        //cout<<bal[N-1][0]<<" "<<bal[N-1][1]<<" "<<bal[N-1][2];



        ll xx=max(bal[N-1][0],bal[N-1][1]);

        xx=max(xx,bal[N-1][2]);



        cout<<xx<<endl;

        return 0;

}