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

using namespace std;

std::vector<int> days[100010];

std::vector<int> cost[3];

int main()

{

    int n;

    cin>>n;

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

    {

        int a,b,c;

        cin>>a>>b>>c;

        days[i].push_back(a);

        days[i].push_back(b);

        days[i].push_back(c);

        if(!i)

        {

            cost[0].push_back(a);

            cost[0].push_back(b);

            cost[0].push_back(c);

        }

        else

        {

           cost[i].push_back(0);

            cost[i].push_back(0);

            cost[i].push_back(0);

        }

    }



    for(int i=0; i<n-1; i++)

    {



        //activity a

        if(cost[i+1][1]<cost[i][0]+days[i+1][1])

            cost[i+1][1]=cost[i][0]+days[i+1][1];



        if(cost[i+1][2]<cost[i][0]+days[i+1][2])

            cost[i+1][2]=cost[i][0]+days[i+1][2];



        //activity b

        if(cost[i+1][0]<cost[i][1]+days[i+1][0])

            cost[i+1][0]=cost[i][1]+days[i+1][0];



        if(cost[i+1][2]<cost[i][1]+days[i+1][2])

            cost[i+1][2]=cost[i][1]+days[i+1][2];



        //activity c

        if(cost[i+1][0]<cost[i][2]+days[i+1][0])

            cost[i+1][0]=cost[i][2]+days[i+1][0];



        if(cost[i+1][1]<cost[i][2]+days[i+1][1])

            cost[i+1][1]=cost[i][2]+days[i+1][1];







    }



    int max=cost[n-1][0];

    if(max<cost[n-1][1])

        max=cost[n-1][1];

    if(max<cost[n-1][2])

        max=cost[n-1][2];

    cout<<max<<endl;



    return 0;

}


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

#define endl '\n'

#define ll long long int

#define loop(i,a,b)           for(ll i=a;i<=b;++i)

#define pb                    push_back

#define F                     first

#define S                     second

#define mp                    make_pair

#define clr(x)                x.clear()

#define MOD                   1000000007

#define itoc(c)               ((char)(((int)'0')+c))

#define vl                    vector<ll>

#define SZ(x)                 (x).size()

#define all(p)                p.begin(),p.end()

#define mid(s,e)              (s+(e-s)/2)

#define sv()                  ll t,n; scanf("%lld",&t);n=t; while(t--)

#define tcase()               ll t,n; cin>>t;n=t; while(t--)

#define iscn(num)             scanf("%d",&num);

#define scn(num)              scanf("%lld",&num);

#define scn2(num,num2)        scanf("%lld%lld",&num,&num2);

#define dbg(x)                cerr <<"( "<<#x << " = " << x << " )"<<endl

using namespace std;

const ll INF = 2e18 + 99;

typedef pair<ll,ll> Pair;

typedef vector<ll> vec;;

void FAST_IO();

void ara_read(vec &v,ll n);

////////////////////////



int main()

{

	ll n; 

	scanf("%lld",&n);

	vector<vector<ll> >holiday(n,vector<ll>(3,0));

	vector<vector<ll> >dp(2,vector<ll>(3,0));

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

		scanf("%lld%lld%lld",&holiday[i][0],&holiday[i][1], &holiday[i][2]);

		assert(i!=n);

	}

	bool next=1, prev=0;

	for(auto x : {0,1,2}){

		dp[0][x]=holiday[0][x];

	}

	// let's do dp operations...

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

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

			for(int x : {0,1,2}){

				if(x==j)

					continue ;

				else {

					dp[next][j]=max(dp[next][j], holiday[i][j]+dp[prev][x]);

				}

			}

		}

		swap(next,prev);

	}

	// printing the ans ...

	printf("%lld\n",max({dp[prev][0] ,dp[prev][1] ,dp[prev][2]}));

    return 0;

}



void FAST_IO()

{

    // ios_base::sync_with_stdio(0);

    //cin.tie(NULL);

    //cout.tie(NULL);

    //cout.setf(ios::fixed);

    //cout.precision(2);



}

void ara_read(vec &v,ll n){

	ll temp;

	for(ll i=0; i<n; i++){

		scanf("%lld",&temp);

		v.emplace_back(temp);

	}

	

}