#include <bits/stdc++.h>
using namespace std;
#define fastIO          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define mp              make_pair
#define in              insert
#define ff              first
#define ss              second
#define vv              vector
#define vll             vector <ll>
#define pll             pair <ll,ll>
#define vpll            vector <pll>
#define umap            unordered_map
#define uset            unordered_set
#define mset            multiset
#define pqueue          priority_queue
#define stk             stack<ll>
#define que             queue<ll>
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define gcd(a,b)        __gcd(a,b)
#define rev             reverse
#define Y               "YES"
#define N               "NO"
#define br              "\n"
#define sp              " "
#define debug(x)        cout << #x << " : " << x << endl;
const ll mod = 1000000007;
const ll MOD = 998244353;
const ll inf = 1e18;
const ll MAX = 2e5 + 1;


// ====== int_1024t begins ======
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// ====== int_1024t ends ======

inline ll add(ll a, ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a, ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a, ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x, ll n) {
	x = x % mod;
	if (!n) return 1;
	if (n & 1) return mul(x, pwr(mul(x, x), (n - 1) / 2));
	else return pwr(mul(x, x), n / 2);
}
// O(nlogn) for [1,n]
ll modinv(ll n) {
	return pwr(n, mod - 2);
}
// O(logn) for[1,n]
ll inv(ll i) {
	if (i == 1) return 1;
	return (MOD - (MOD / i) * inv(MOD % i) % MOD) % MOD;
}
// =============================

const int INF = 1e9 + 5;
vector<int> a, b, c;
int n, k;
int dp[2][2][2][100005];
int ans;
int f(int i, int j, int k, int n)
{

	if (n == 0)
		return 0;

	if (dp[i][j][k][n] != -1)
		return dp[i][j][k][n];

	ans = -INF;
	if (i == 1 && j == 1 && k == 1)
		ans = max({a[n] + f(0, 1, 1, n - 1), b[n] + f(1, 0, 1, n - 1), c[n] + f(1, 1, 0, n - 1)});

	if (i == 0 && j == 1 && k == 1)
		ans = max(b[n] + f(1, 0, 1, n - 1), c[n] + f(1, 1, 0, n - 1));

	if (i == 1 && j == 0 && k == 1)
		ans = max(a[n] + f(0, 1, 1, n - 1), c[n] + f(1, 1, 0, n - 1));

	if (i == 1 && j == 1 && k == 0)
		ans = max(b[n] + f(1, 0, 1, n - 1), a[n] + f(0, 1, 1, n - 1));

	return dp[i][j][k][n] = ans;


}

void solve()
{

	memset(dp, -1, sizeof(dp));
	cin >> n;
	a.resize(n + 1); b.resize(n + 1); c.resize(n + 1);
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
	}

	cout << f(1, 1, 1, n);


}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t;
	// cin >> t;
	// while (t--)
	// {
	solve();
	// }

	return 0;
}

Measured memory_bytes: 15300