#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <list>
#include <algorithm>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <algorithm>
#include <cstdint>
#include <list>
#include <string.h>
#include <unordered_map>
#include <assert.h>
#include <ctype.h>
#include <queue>
#include <numeric>
#include <vector>
#include <iomanip>
#include <deque>
#include <cstdlib>
#include <stack>
#include <ctime>
#define  lld  long long int
#define newline cout << endl
#define pb push_back
#define mp make_pair
lld shouldendl = 1;
#define se second
#define fi first
#define sfind(s,ele) (s).find((ele));
#define SPEED ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define starttime chrono::time_point<chrono::system_clock> start, end; start = chrono::system_clock::now()
#define showtime end = chrono::system_clock::now();  chrono::duration<double> elapsed_seconds = end - start; time_t end_time = chrono::system_clock::to_time_t(end); cout << "elapsed time: " << elapsed_seconds.cnt() << "s\n"
lld INF = (lld)(1e9 + 7);
lld MOD =  (lld)(1e9 + 7);
#define fileopen   freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
using namespace std;
lld modInverse(lld a ) {   lld m = MOD, m0 = m, y = 0, x = 1;  if (m == 1) return 0;   while (a > 1) {  lld q = a / m, t = m;  m = a % m, a = t, t = y;          y = x - q * y, x = t;   } if (x < 0)  x += m0; return x; }
lld add(long long a, long long b) {return ((a % MOD) + (b % MOD)) % MOD;}
lld mul(long long a, long long b) {return ((a % MOD) * (b % MOD)) % MOD;}
lld sub(long long a, long long b) {lld ans = ((a % MOD - b % MOD)) % MOD; if (ans < 0) ans += MOD; return ans;}
lld gcd(lld a, lld b) {if (b == 0) return a; return gcd(b, a % b);}
void MAIN(lld i, lld t);
int get() {lld t; cin >> t; ; return t;}
template<class T> int logd(T name) {cout << name << endl; return 0;}
void test(int t) { for (lld i = 1; i <= t; i++) {MAIN(i, t); if (shouldendl) cout << endl; } }
lld power(lld x, lld y) { lld res = 1; x = x % MOD; if (x == 0) return 0;   while (y > 0) {   if (y & 1)      res = (res * x) % MOD; y = y >> 1; x = (x * x) % MOD;} return res; }
template <typename T, typename U> std::pair<T, U> operator+(const std::pair<T, U> & l, const std::pair<T, U> & r) {   return {l.first + r.first, l.second + r.second};                                    }
#define all(v) (v).begin(),(v).end()
lld popcnt(lld x) {return __builtin_popcountll(x);}
lld lcm(lld a, lld b) { return (a * b) / gcd(a, b);}
template<class T> bool input(vector<T> &v, lld n = -1) { if (n == -1) assert(v.size() != 0); if (n == -1) n = v.size();    for (auto &i : v) cin >> i; return 0;}
template<class T> bool print(vector<T> v, lld l = 0, lld r = -1) {  if (r == -1) r = v.size();   for (int i = l; i < r; i++) cout << v[i] << " "; return 0;}
//Observation, binary_search, dfs on strings, simplify the problem
//Observe and ELIMINATE
lld n;
lld dp[300005][5];
vector<vector<int> > v(3);
lld solve(lld i,lld j){
    if(i==n) return 0;
  
    if(dp[i][j]!=-1) return dp[i][j];
    lld p = 0;
    for(int k = 0;k<3;k++){
        if(k!=j) p = max(p,v[k][i] + solve(i+1,k));
    }

    return dp[i][j] = p;
}
void MAIN(lld current_test_case, lld total_test_cases) {  
    cin >>  n;
    for(int i = 0;i<3;i++) v[i].resize(n);
    for(int i = 0;i<n;i++){
        for(int j = 0;j<3;j++)
            cin >> v[j][i];
    }
    memset(dp,-1,sizeof(dp));
    cout << solve(0,3);
}
int main() {
  SPEED;
  #ifndef ONLINE_JUDGE
    fileopen
  #endif
  test(1);
  return 0;
}



Measured memory_bytes: 21740