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

#include <algorithm>

#include <iostream>

#include <iomanip>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cstring>

#include <vector>

#include <string>

#include <climits>

#include <map>

#include <set>

#include <stack>

#include <queue>

#include <deque>

#include <stdio.h>

//#define int long long

using namespace std;

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

#define endl '\n'

#define OnlineJudgec

#define F first

#define S second

#define  precision(n)  cout << fixed << setprecision(n)

#define clr(v,d ) memset(v, d, sizeof(v))

typedef long long ll;

typedef vector<int> vi;

void init()

{

    cin.tie(0);

    cin.sync_with_stdio(0);

    cout.tie(0);

    #ifdef OnlineJudge

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

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

    #endif

}

ll S(ll x){ll s = 0;while(x){s += x % 10;x /= 10;}return s;} /// sum of digits.

ll powe(ll a , ll n){if(n == 1)return a;return a * powe(a ,n-1);}

ll com(int n,int m){ll z = 1;for(int i = 0; i < m;i++){z = z * ( n - i) / (i + 1) ;}return z;}

int dx[] = {1,-1,0,0};

int dy[] = {0,0,1,-1};

int dr[] = {0,0,0,1,1,1,-1,-1,-1};

int dc[] ={-1,0,1,-1,0,1,-1,0,1};

/// <<------------------------------------------------------------------------------>>

const int mx = 100009;

int n , k;

int arr[mx][4];

int dp[mx][4];

int solve(int idx , int last)

{

     if(idx == n)return 0;

     int &ret = dp[idx][last];

     if(~ret) return ret;

     int A = 0 ,B = 0 ,C = 0;

     if(last != 0)

        A = solve(idx+1 , 0) + arr[idx][0];

     if(last != 1)

        B = solve(idx+1 , 1) + arr[idx][1];

     if(last != 2)

        C = solve(idx+1 , 2) + arr[idx][2];

     return ret = max(A,max(B,C));

}

/// <<------------------------------------------------------------------------------>>

int main()

{

    init();

    cin >> n;

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

    {

        cin >> arr[i][0] >> arr[i][1] >> arr[i][2];

    }

    clr(dp,-1);

    cout<<solve(0,3);

}


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

}