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

typedef long long ll;

using namespace std;

const int N = 2e5+10 , M = 5e5+10, OO = 0x3f3f3f3f ,  MOD = 1e9+7;

const double EPS = 1e-3;

#define M_PI 3.14159265358979323846

#define clr(arr,val) memset(arr , val , sizeof (arr))

#define loop(i,n) for(int i = 0;i < int(n);i++)

#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)

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

#define pb push_back

#define F first

#define S second

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

#define sz(v)  ((int)((v).size()))

typedef pair <int,int> pii ;

typedef vector < pii > vii ;

typedef vector < int > vi;

int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction

//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction

//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction

//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

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

//freopen("output.txt", "w", stdout);







int n,x;

int a[N],b[N],c[N];

ll dp[N][4];





ll solve(int idx, int preC){ //preColour = (1 : a) -- (2 : b) -- (3 : c) -- (0 : invalid)



    if(idx == n) return 0;



    ll& ret = dp[idx][preC];

    if(~ret) return ret;



    ret = -OO;

    if(preC != 1) ret = max(ret, solve(idx+1 , 1)+a[idx]);

    if(preC != 2) ret = max(ret, solve(idx+1 , 2)+b[idx]);

    if(preC != 3) ret = max(ret, solve(idx+1 , 3)+c[idx]);



    return ret;



}







int main(){





    //ios_base::sync_with_stdio(0);

    //cin.tie(0);cout.tie(0);





    scanf("%d",&n);

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

        scanf("%d %d %d",a+i,b+i,c+i);



    memset(dp, -1 , sizeof dp);

    ll ans = solve(0 , 0);

    printf("%lld\n",ans);







    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 7.626944648590362x):
#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;



    }

}