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

using namespace std;

const int oo = 1e9;



int n;

const int nx = 1e5+5;

int ac[nx][3];

int dp[3][nx];

int go(int a, int i)

{

	if(i==n) return 0;

	if(dp[a][i] != -1) return dp[a][i];

	int& ans = dp[a][i];

	if(a==0)

	{

		ans=max(ans, go(1, i+1)+ac[i][0]);

		ans=max(ans, go(2, i+1)+ac[i][0]);

	}

	if(a==1)

	{

		ans=max(ans, go(0, i+1)+ac[i][1]);

		ans=max(ans, go(2, i+1)+ac[i][1]);

	}

	if(a==2)

	{

		ans=max(ans, go(0, i+1)+ac[i][2]);

		ans=max(ans, go(1, i+1)+ac[i][2]);

	}

	

	return ans;

	

}

int main()

{

    cin>>n;

    for(int i=0; i<n; i++) cin>>ac[i][0]>>ac[i][1]>>ac[i][2];

    memset(dp, -1, sizeof dp);

    cout<<max(go(0,0), max(go(1,0),go(2,0)))<<"\n";

    return 0;

}

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp> 

#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace __gnu_pbds;

using namespace std;

#define getbit(n, i) (((n) & (1LL << (i))) != 0) 

#define setbit0(n, i) ((n) & (~(1LL << (i)))) 

#define setbit1(n, i) ((n) | (1LL << (i))) 

#define togglebit(n, i) ((n) ^ (1LL << (i))) 

#define lastone(n) ((n) & (-(n))) 

char gap = 32;

template<typename T> 

ostream& operator<<(ostream &os, const vector<T> &v) { 

    os << '{'; 

    for (const auto &x : v) os << gap << x;

        return os << '}'; 

}

template<typename A, typename B> 

ostream& operator<<(ostream &os, const pair<A, B> &p) {

        return os << '(' << p.first << gap << p.second << ')';

}



template <class T>

void read(T &x) {

    char c;

    for (c = getchar(); c < '0' || c > '9'; c = getchar())

        ;

    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);

}

#define ll long long 

#define lll __int128_t

#define pb push_back

#define mp make_pair

typedef pair < int,int> ii;

typedef vector<ii> vii;

typedef vector<ll>vl;

typedef vector<int> vi;

typedef vector<vi> vvi;

typedef tree<

int,

null_type,

less<int>,

rb_tree_tag,

tree_order_statistics_node_update>

ordered_set;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll hashPrime = 1610612741;

ll n;

ll a[200005];

ll b[200005];

ll c[200005];

ll dp[200005][4];

ll recurse(ll day,ll prev){

    if(day==n){

    	if(prev==1){

    		return max(b[day],c[day]);

		}

		else if(prev==2){

			return max(a[day],c[day]);

		}

		else{

				return max(b[day],a[day]);

			}

		}

		if(dp[day][prev]!=-1)

		  return dp[day][prev];

		//if(prev==0){

			//return max(recurse(day+1,1),max(recurse(day+1,2),recurse(day+1,3)));

	//	}

		if(prev==1){

			return dp[day][prev]=max(b[day]+recurse(day+1,2),c[day]+recurse(day+1,3));

		}

		else if(prev==2){

			return dp[day][prev]=max(a[day]+recurse(day+1,1),c[day]+recurse(day+1,3));

		}

		else if(prev==3){

			return dp[day][prev]=max(b[day]+recurse(day+1,2),a[day]+recurse(day+1,1));

		}

}

int main()

    {

       ios_base::sync_with_stdio(false);

        cin.tie(0);

        ll i,j,k,l,m;

        cin>>n;

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

        	dp[i][1]=-1;

        	dp[i][2]=-1;

        	dp[i][3]=-1;

		}

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

        	cin>>a[i]>>b[i]>>c[i];

		}

		ll maxi=max(recurse(1,1),max(recurse(1,2),recurse(1,3)));

		cout<<maxi;

    	return 0;

}