// 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.202825592235198x):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define io ios_base::sync_with_stdio(false);cin.tie(NULL)

//the function below is used to input integars(int) quickly;int a=readInt();

int readInt () {

	bool minus = false;

	int result = 0;

	char ch;

	ch = getchar();

	while (true) {

		if (ch == '-') break;

		if (ch >= '0' && ch <= '9') break;

		ch = getchar();

	}

	if (ch == '-') minus = true; else result = ch-'0';

	while (true) {

		ch = getchar();

		if (ch < '0' || ch > '9') break;

		result = result*10 + (ch - '0');

	}

	if (minus)

		return -result;

	else

		return result;

}



ll bigpow(ll base,ll pw,ll M)

{

	if(pw==0) return 1;

	if(pw%2==0)

	{

		ll ret=bigpow(base,pw/2,M);

		return ((ret%M)*(ret%M))%M;

	}

	else return ((base%M)*(bigpow(base,pw-1,M)))%M;



}

ll maxi(ll a,ll b)

{

    if(a>b)return a;

    return b;

}

ll mini(ll a,ll b)

{

    if(a<b)return a;

    return b;

}

ll abse(ll a)

{

    if(a<0)return -a;

    return a;

}

ll ceili(ll a,ll div)

{

    return (a+div-1)/div;

}

int dp[100005][3]={0};

int ara[100005][3];

int N;

int f(int i,int row)

{

    if(row>=N)return 0;

    if(i>2)i-=3;

    if(dp[row][i])return dp[row][i];

    return dp[row][i]= maxi(ara[row][i]+f(i+1,row+1),ara[row][i]+f(i+2,row+1));



}

int main(void)

{

    io;

    int t;

    t=1;

    while(t--)

    {

        N=readInt();

        int i,j;

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

        {

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

                ara[i][j]=readInt();

        }

        ll ans=maxi(f(0,0),maxi(f(1,0),f(2,0)));

        cout<<ans;



    }

}