#include<bits/stdc++.h>

using namespace std;

// =============== Template ===============

using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9+7;

// ---------- Data structures ----------

// Union-Find
struct UnionFind {
  vector<int> data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool merge(int x, int y) {
    x = root(x), y = root(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return true;
  }
  
  int root(int k) {
    if(data[k] < 0) return k;
    return data[k] = root(data[k]);
  }
 
  int size(int k) {
    return (-data[root(k)]);
  }
};

// ModInt ( Const )
template <int MOD>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % MOD : (MOD - (-y) % MOD) % MOD) {}
  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if((x += MOD - p.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % MOD);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = MOD, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< MOD >(t);
    return is;
  }
};
using modint = ModInt<MOD>;

// ---------- Algorithms ----------

// Greatest Common Divisor
template <typename T>
T gcd(T a, T b){return b?gcd(b,a%b):a;}

// Least Common Multiple
template <typename T>
T lcm(T a, T b){return a*b/gcd(a,b);}

// Extended Euclidean Algorithm
template <typename T>
ll extgcd(ll a, ll b, T &x, T &y){
	if(b == 0){
		x = 1, y = 0;
		return a;
	}
	T g = extgcd(b, a%b, x, y);
	T nextx = y, nexty = x-(a/b)*y;
	x = nextx, y = nexty;
	return g;
}

// Modular Exponentiation
ll mod_pow(ll a, ll n, ll p){
	if(n == 0) return 1;
	if(n%2 == 1) return (a * mod_pow(a, n-1, p)) % p;
	ll t = mod_pow(a, n/2, p);
	return (t*t) % p;
}

// Divisor O(sqrt(N))
vector< int64_t > divisor(int64_t n) {
  vector<int64_t> ret;
  for(int64_t i = 1; i*i <= n; ++i) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i*i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

// Prime-Factor O(sqrt(N))
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

// Is-Prime O(sqrt(N))
bool is_prime(int64_t n){
	for(int64_t i = 2; i*i <= n; ++i){
		if(n % i == 0) return false;
	}
	return true;
}

// Prime-Table O(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}


// ========================================

int N;
int input[3][100005];
int dp[100005][3];

int main(){
	cin >> N;
	for(int i = 0; i < N; ++i) cin >> input[0][i] >> input[1][i] >> input[2][i];
	
	dp[0][0] = input[0][0], dp[0][1] = input[1][0], dp[0][2] = input[2][0];

	for(int i = 1; i < N; ++i){
		for(int j = 0; j < 3; ++j){
			for(int k = 0; k < 3; ++k){
				if(j == k) continue;
				dp[i][j] = max(dp[i][j], dp[i-1][k]);
			}
			dp[i][j] += input[j][i];
		}
	}
	int ans = 1;
	for(int i = 0; i < 3; ++i) ans = max(ans, dp[N-1][i]);
	cout << ans << endl;
}

Measured memory_bytes: 2560