//============================================================================
// Name        : competitive_programing.cpp
// Author      : .Data_Nerd.
// Description : problem solving training
//============================================================================

#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define PI acos(-1)
#define dot(a, b) (conj(a) * (b)).real()
#define cross(a, b) (conj(a) * (b)).imag()
#define Data_Nerd ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define Y imag()
#define X real()
#define EPS 1e-7
#define mod 1000000007
#define N 1e2
using namespace std;
typedef complex <ld> point;
typedef vector <point> polygon;
typedef tuple <ld, ld, ld> line;
typedef vector <point> spolygon;

line lineeq(point x, point y){
	ll a = y.Y - x.Y;
	ll b = x.X - y.X;
	ll c = -a * x.X - b * x.Y;
	ll gcd = abs(__gcd(a, __gcd(b, c)));
	if(a < 0 || (a == 0 && b < 0)) gcd *= -1;
	a /= gcd; b /= gcd; c /= gcd;
	return line(a, b, c);
}

point getpoint(line l1, line l2){
	ld y = (get<0>(l1) * get<2>(l2) - get<0>(l2) * get<2>(l1)) / (get<0>(l2) * get<1>(l1) - get<0>(l1) * get<1>(l2));
	ld x = (get<2>(l1) * get<1>(l2) - get<2>(l2) * get<1>(l1)) / (get<0>(l2) * get<1>(l1) - get<0>(l1) * get<1>(l2));
	return point(x, y);
}

bool onray(point a, point b, point c){
	return dot(b - a, c - a) > -EPS;
}

ll fact(ll n){
	if(n == 0) return 1;
	return n * fact(n - 1);
}

bool isPrime(ll q){
	if(q == 0 || q == 1) return false;
	for(int i = 2; i * i <= q; i++) if(q % i == 0) return false;
	return true;
}

point rotate(point p, ld a){
	return p * polar((ld)1, a * PI / 180);
}

bool canBe(line l1, line l2){
	if(get<0>(l2) * get<1>(l1) - get<0>(l1) * get<1>(l2) != 0) return true;
	return false;
}

ld getangle(point p){
	return arg(p) * 180 / PI;
}

ll fp(ll base, ll x){
	if(x == 0) return 1;
	ll ans = fp(base, x / 2);
	ans = (ans * ans) % mod;
	if(x % 2)
		ans = ((base % mod) * ans) % mod;
	return ans;
}

ll GCD(ll a, ll b){
	if(b == 0) return a;
	if(a == 0) return b;
	return GCD(b, a % b);
}

ll LCM(ll a, ll b){
	return (a * b) / GCD(a, b);
}


ll fac[(int)1e4 + 7], inv[(int)1e4 + 7];

void calcFacAndInv(ll n){
    fac[0] = inv[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        fac[i] = (i * fac[i - 1]) % mod;
        inv[i] = fp(fac[i], (ll)mod - 2);
    }
}

ll ncr(ll n, ll r){
    return ((fac[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll npr(ll n, ll r){
    return (fac[n] * inv[n - r]) % mod;
}

ll p[55][55] = {};

void pascal(){
    p[0][0] = 1;
    for(int i = 1; i < 55; i++) {
        p[i][0] = 1;
        for(int j = 1; j <= i; j++) p[i][j] = p[i - 1][j] + p[i - 1][j - 1];
    }
}

int main() {
	Data_Nerd
	int n; cin >> n;
	ll hap[n][3] = {}, res[n][3] = {};
	for(int i = 0; i < n; i++){
		cin >> hap[i][0] >> hap[i][1] >> hap[i][2];
	}
	res[0][0] = hap[0][0], res[0][1] = hap[0][1], res[0][2] = hap[0][2];
	for(int i = 1; i < n; i++){
		res[i][0] = max(res[i - 1][1], res[i - 1][2]) + hap[i][0];
		res[i][1] = max(res[i - 1][0], res[i - 1][2]) + hap[i][1];
		res[i][2] = max(res[i - 1][1], res[i - 1][0]) + hap[i][2];
	}
	cout << max(res[n - 1][0], max(res[n - 1][1], res[n - 1][2])) << endl;
	return 0;
}


Measured memory_bytes: 4992