// Slower C++ solution:
#include <cstdio>

#include <cstdint>

#include <cinttypes>

#include <cstring>

#include <algorithm>



using i32 = std::int_fast32_t;



const int MaxN = 100001;



int A[MaxN][3], dp[MaxN][3];



signed main(signed argc, char **argv) {

	i32 n;

	std::scanf("%" SCNdFAST32, &n);

	

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

		std::scanf("%" SCNdFAST32 "%" SCNdFAST32 "%" SCNdFAST32, A[i], A[i] + 1, A[i] + 2);

	}

	

	memset(dp, 0, sizeof dp);

	

	dp[0][0] = A[0][0];

	dp[0][1] = A[0][1];

	dp[0][2] = A[0][2];

	

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

		for (i32 j = 0; j < 3; ++ j) {

			for (i32 a = 0; a < 3; ++ a) {

				if (a == j) {

					continue;

				}

				dp[i][j] = std::max(dp[i][j], dp[i - 1][a] + A[i][j]);

			}

		}

	}

	

	std::printf("%" PRIdFAST32, std::max(dp[n - 1][0], std::max(dp[n - 1][1], dp[n - 1][2])));

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3738499930418857x):
#include <iostream>

#include <stdio.h>

#include <string>

#include <cstring>

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <deque>

#include <stack>

#include <bitset>

#include <iomanip>



#define ll long long

#define ld long double

#define ull unsigned long long

#define endl "\n"

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

#define f(a, b, c) for(int a = b; a < c; a++)

using namespace std;





//ll fact[1000001]; ll inv[1000001];

//ll primes[100007];

//ll arr[1000007];

//ll modPower(ll b, ll p) {

//	if (p == 0)

//		return 1;

//

//	ll halfpow = modPower(b, p / 2);

//	ll toReturn = (halfpow * halfpow) % mod;

//	if (p % 2)

//		toReturn = (toReturn * b) % mod;

//

//	return toReturn;

//}

//

//ll fastPower(ll b, ll p) {

//	if (p == 0)

//		return 1;

//	ll ans = fastPower(b, p / 2);

//	ans = (ans * ans);

//	if (p % 2 != 0)

//		ans = (ans * b);

//	return ans;

//}

//ll GcdRecursive(ll a, ll b) {

//	if (b == 0) return a;

//	return GcdRecursive(b, a % b);

//}

//ll modLCM(ll a, ll b) {

//	ll val = GcdRecursive(a, b);

//	ll tmp = ((a % mod) * (b % mod)) % mod;

//	ll finalVal = ((tmp % mod) * (arr[val] % mod)) % mod;

//	return finalVal;

//

//}

//ll LCM(ll a, ll b) {

//	return (a * b) / GcdRecursive(a, b);

//}

//void move1step(ll& a, ll& b, ll q) { // a and b by reference

//	ll c = a - q * b;

//	a = b;

//	b = c;

//}

//ll GcdIterative(ll a, ll b) {

//	while (b) move1step(a, b, a / b);

//	return a;

//}

//

//void pre(ll n) {

//

//	fact[0] = 1;

//	inv[0] = 1;

//

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

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

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

//		arr[i] = modPower(i, mod - 2);

//	}

//}

//

//ll npr(ll n, ll r) {

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

//}

//

//ll ncr(ll n, ll r) {

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

//}

//

//void sieve(ll val) {

//	memset(primes, 1, sizeof primes);

//	primes[0] = primes[1] = false;

//	for (int i = 2; i <= val; i++) {

//		if (primes[i]) {

//			for (int j = i * i; j <= val; j += i) {

//				primes[j] = 0;

//			}

//		}

//	}

//

//}



const ll mod = 1e9 + 7;

const ll N = 1e5 + 7;





ll n, x, y, z;





int main()

{

    MohamedMotaz;



    cin >> n;

    ll dp[n][3];

    f(i,0,n){



        cin >> x >> y >> z;

        if (i == 0) { dp[0][0] = x, dp[0][1] = y, dp[0][2] = z; continue;}



        dp[i][0] = x + max(dp[i - 1][1], dp[i - 1][2]);

        dp[i][1] = y + max(dp[i - 1][2], dp[i - 1][0]);

        dp[i][2] = z + max(dp[i - 1][1], dp[i - 1][0]);



    }



    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});









}