// 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.569412141150354x):
#include <iostream>

#include <string>

#include<iomanip>

#include <algorithm>

#include <map>

#include <vector>

#include<queue>

#include<math.h>

#include<cmath>

#include<sstream>

#include<set>

#include <map>

#include<string.h>

#include<sstream>

#include<stack>

#include<unordered_map>

#include <iostream>

#include <stdio.h>

#include <stdlib.h>

#include <ctype.h>

#include <cstdio>

#include <cstdlib>

#include <complex>

#define ll long long

#define  point complex<double>

#define  pi acos(-1)

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

#define arr2dof vector  vector<vector<int>>dp(N,vector<int>(2, inf));

using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7, inff = -1e12,inf=1e12;

const double ep = 0.0000000001;

//const double pi = 3.14159265359;



double dot(point a, point b) {

	return  (conj(a)*b).real();

}

double cross(point a, point b) {

	return  (conj(a)*b).imag();

}

double angle(point a, point b)

{

	double dt = dot(a, b);

	dt /= abs(a);

	dt /= abs(b);

	return acos(dt) * 180.0 / pi;

}



bool isrightangel(int ind) {//90 degree

	vector<point>v;

	return(angle(v[ind] - v[(ind + 1) % 3], v[ind] - v[(ind + 2) % 3]) == 90);//bshof hal eldot producty3ny fe

	//dl3en 3moden 3ashn yb2a right trinagle

}



ll fact[1000006], inv[1000006];



ll fp(ll base, ll exp)

{

	if (exp == 0)

		return 1;

	ll ans = fp(base, exp / 2);

	ans = (ans * ans) % mod;

	if (exp % 2 != 0)

		ans = (ans * (base % mod)) % mod;

	return ans;

}



void calcFacAndInv(ll n)

{

	fact[0] = inv[0] = 1;

	for (ll i = 1; i <= n; i++)

	{

		fact[i] = (i * fact[i - 1]) % mod;

		inv[i] = fp(fact[i], mod - 2);

	}

}



ll ncr(ll n, ll r)

{

	return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;

}



ll npr(ll n, ll r)

{

	return (fact[n] * inv[n - r]) % mod;

}













	int dpa[100005], dpb[100005], dpc[100005];

int main()

{

	ll n,arr[100005],a,b,c;

	char tmp;

	cin >> n;

	

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

		cin >> dpa[i] >> dpb[i] >> dpc[i];

	}

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

		dpa[i] += max(dpb[i - 1], dpc[i - 1]);

		dpb[i] += max(dpa[i-1], dpc[i-1]);

		dpc[i] += max(dpb[i-1], dpa[i-1]);

	}

	cout << max(dpa[n - 1], max(dpb[n - 1], dpc[n - 1]));



	return 0;

}