#include<bits/stdc++.h>
using namespace std;


// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef complex<int> ci;
typedef complex<double> cd;
typedef complex<long double> cld;

// macros
#define rep(i, a, b) for(int i=a; i<b; i++)
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define tr(c, it) for(auto it=(c).begin(); it!=c.end(); it++)
#define pb push_back
#define mp make_pair
#define bitcount __builtin_popcount
#define ispresent(c, x) ((c).find(x) != (c).end())
#define watch(x) cout<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// template functions
template <typename T>
inline void printV(vector<T>& a) { rep(i, 0, sz(a)) { cout<<a[i]<<" "; } cout<<"\n"; }
template <typename T>
inline void print(T a) { cout<<a<<"\n"; }
template <typename T>
inline void print(T a, T b) { cout<<a<<" "<<b<<"\n"; }
template <typename T>
inline void print(T a, T b, T c) { cout<<a<<" "<<b<<" "<<c<<"\n"; }
template <typename T>
inline void print(T a, T b, T c, T d) { cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n"; }
template <typename T>
inline void printpii(pair<T, T> p) { cout<<p.first<<" "<<p.second<<"\n"; }
template <typename T>
inline void printVV(vector<vector<T>>& a)
{
	rep(i, 0, sz(a)) {
		printV(a[i]);
	}
	cout<<"\n";
}

template <typename T>
inline void clearVV(vector<vector<T>>& a)
{
	for(auto& x:a) {
		x.clear();
	}
	a.clear();
}
template <typename T>
inline void assignVV(vector<vector<T>> &a, T val)
{
	for(int i=0; i<sz(a); i++) {
		for(int j=0; j<sz(a[i]); j++) {
			a[i][j]=val;
		}
	}
}

template <typename T>
inline void readV(vector<T>& a) { rep(i, 0, sz(a)) cin>>a[i]; }
template <typename T>
inline void read(T& a) { cin>>a; }
template <typename T>
inline void read(T& a, T& b) { cin>>a>>b; }
template <typename T>
inline void read(T& a, T& b, T& c) { cin>>a>>b>>c; }
template <typename T>
inline void read(T& a, T& b, T& c, T& d) { cin>>a>>b>>c>>d; }
template <typename T>
inline void readpii(pair<T, T>& p) { cin>>p.first>>p.second; }
template <typename T>
inline void readVV(vector<vector<T>>& a)
{
	rep(i, 0, sz(a)) {
		readV(a[i]);
	}
}


// constants
const long double eps = 1e-9;
const int inf = 5e8;
const int modn = 1e9+7;
const int MAX = 1e5;

vector<vector<ll>> a;
vector<vector<ll>> dp;
int n;

int solve(int i, int type)
{
	if(i>n-1) return 0;
	if(i==n-1) {
		if(type==0) {
			return max(a[i][1], a[i][2]);
		}
		else if(type==1) {
			return max(a[i][0], a[i][2]);
		}
		else {
			return max(a[i][0], a[i][1]);
		}
	}
	
	if(dp[i][type]!=-1) return dp[i][type];
	ll &memo=dp[i][type];
	
	if(type==0) {
		ll ans1=solve(i+1, 1)+a[i][1];
		ll ans2=solve(i+1, 2)+a[i][2];
		return memo=max(ans1, ans2);
	}
	else if(type==1) {
		ll ans1=solve(i+1, 0)+a[i][0];
		ll ans2=solve(i+1, 2)+a[i][2];
		return memo=max(ans1, ans2);
	}
	else {
		ll ans1=solve(i+1, 0)+a[i][0];
		ll ans2=solve(i+1, 1)+a[i][1];
		return memo=max(ans1, ans2);
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
	
	cin>>n;
	a.resize(n+1, vector<ll>(3));
	dp.resize(n+1, vector<ll>(3));
	for(int i=0; i<n; i++) {
		for(int j=0; j<3; j++) {
			dp[i][j]=-1;
		}
	}
	for(int i=0; i<n; i++) {
		for(int j=0; j<3; j++) {
			cin>>a[i][j];
		}
	}
	ll ans1=solve(1, 0)+a[0][0];
	ll ans2=solve(1, 1)+a[0][1];
	ll ans3=solve(1, 2)+a[0][2];
	ll ans4=max(ans1, ans2);
	ll ans=max(ans3, ans4);
	cout<<ans<<"\n";
    return 0;
}



Measured memory_bytes: 15872