// Slower C++ solution:
#include<bits/stdc++.h>

#include <ext/pb_ds/tree_policy.hpp>

#include <ext/pb_ds/assoc_container.hpp>



using namespace __gnu_pbds;

using namespace std;





template <typename T>using ordered_set = tree<T, null_type, less<T>,rb_tree_tag, tree_order_statistics_node_update>;



#define PI              acos(-1.0)

#define en '\n'

#define Infi 0x3f3f3f3f

#define LInfi 0x3f3f3f3f3f3f3f3f



#define setzero(a)    memset(a,0,sizeof(a))

#define setneg(a)     memset(a,-1,sizeof(a))

#define setinf(a)     memset(a,126,sizeof(a))





#define READ_IN freopen("Input.txt","r",stdin);

#define READ_OUT freopen("Output.txt","w",stdout);





const int dx[] = {+1,-1,+0,+0};                         // 4 X directions

const int dy[] = {+0,+0,+1,-1};                         // 4 Y directions

const int dx8[] = {+0,+0,+1,-1,-1,+1,-1,+1};            // King X Moves

const int dy8[] = {-1,+1,+0,+0,+1,+1,-1,-1};            // King Y Moves

const int kx[] = {-2, -2, -1, -1,  1,  1,  2,  2};      // Knight X Moves

const int ky[] = {-1,  1, -2,  2, -2,  2, -1,  1};      // Knight Y Moves







int  Set    (int N,int pos) {return N=N | (1<<pos);}    /// turn a bit on

int  reset  (int N,int pos) {return N= N & ~(1<<pos);}  /// turn a bit off

bool check  (int N,int pos) {return (bool)(N & (1<<pos));} /// check, if a bit is on or not



void __print(int x) {cerr << x;}

void __print(long x) {cerr << x;}

void __print(long long x) {cerr << x;}

void __print(unsigned x) {cerr << x;}

void __print(unsigned long x) {cerr << x;}

void __print(unsigned long long x) {cerr << x;}

void __print(float x) {cerr << x;}

void __print(double x) {cerr << x;}

void __print(long double x) {cerr << x;}

void __print(char x) {cerr << '\'' << x << '\'';}

void __print(const char *x) {cerr << '\"' << x << '\"';}

void __print(const string &x) {cerr << '\"' << x << '\"';}

void __print(bool x) {cerr << (x ? "true" : "false");}



template<typename T, typename V>

void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}

template<typename T>

void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}

void _print() {cerr << "]\n";}

template <typename T, typename... V>

void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE

#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)

#else

#define trace(x...)

#endif



typedef long long int  ll;

typedef unsigned long long int llu;



int dp[100005][5];



vector<vector<int>> vec;



int n;



int make(int pos, int id){



    if(pos==n)return 0;



    if(dp[pos][id]!=-1)return dp[pos][id];



    int ans = 0;



    for(int i=0;i<3;i++){

        if(id==i)continue;



        ans = max(ans , make(pos+1,i) + vec[pos][id]);

    }

    return dp[pos][id] = ans;

}





int main(void){



    cin >> n;



    vec.assign(n+1,vector<int>());



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

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

            int val;

            cin >> val;

            vec[i].push_back(val);

        }

    }



    memset(dp,-1,sizeof(dp));



    int ans = 0;



    for(int i=0;i<3;i++){

        ans = max(ans, make(0,i));

    }



    cout << ans << endl;



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.9482779847284615x):
// #pragma GCC optimize("Ofast,O3,unroll-loops")

// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")



#include <vector>

#include <list>

#include <map>

#include <set>

#include <deque>

#include <queue>

#include <stack>

#include <bitset>

#include <algorithm>

#include <functional>

#include <numeric>

#include <utility>

#include <iostream>

#include <sstream>

#include <iomanip>

#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <cctype>

#include <string>

#include <cstring>

#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <ctime>

#include <climits>

#include <complex>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace __gnu_pbds;

using namespace std;



#define endl '\n'

#define hoise cerr<<"hoise - "<<__LINE__<<"\n"

#define tham getchar()

#define set0(ar) memset(ar, 0, sizeof ar)

#define setinf(ar) memset(ar, 126, sizeof ar)

#define vsort(v) sort(v.begin(), v.end())

#define all(x) (x).begin(), (x).end()

#define FASTIO ios::sync_with_stdio(false);cin.tie(nullptr)



using ll = long long;

using pii = pair <int, int>;

using pll = pair <ll, ll>;

using vi = vector <int>;

using vl = vector <ll>;

using vpii = vector < pii >;

using vpll = vector < pll >;



const int LOG = 20;

const int N = (int)2e5+6;

const double PI = acos(-1.0);

const ll MOD = 1e9 + 7;

const int INF = 1e9;

const double EPS = 1e-6;

const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int knight_x[8] = {2, 1, -1, -2, -2, -1, 2, 1}, knight_y[8] = {1, 2, 2, 1, -1, -2, -1, -2};



#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}

template<typename T, typename... Args>

void err(istream_iterator<string> it, T a, Args... args) {

    cerr << *it << " = " << a << " ";

    err(++it, args...);

    cout << endl;

}



int flipBit (int mask, int k) { return mask = mask ^ (1 << k); }

bool checkBit (int mask, int k) { return (mask >> k) & 1; }

int setBit (int mask, int k) { return mask = mask | (1 << k); }

int resetBit (int mask, int k) { if (checkBit (mask, k)) { mask = flipBit (mask, k); } return mask; }



inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }

inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a * b) % MOD; }

inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a + b) % MOD; }

inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }

inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }

inline ll modInverse(ll a) { return modPow(a, MOD - 2); }

inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }



template <typename T> using orderedSet = tree<T, null_type, greater<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T> using orderedSet1 = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



bool equalTo ( double a, double b ) { if ( fabs ( a - b ) <= EPS ) return true;	else return false; }

bool notEqual ( double a, double b ){ if ( fabs ( a - b ) > EPS ) return true;	else return false; }

bool lessThan ( double a, double b ){ if ( a + EPS < b ) return true;	else return false; }

bool lessThanEqual ( double a, double b ){ if ( a < b + EPS ) return true;	else return false;}

bool greaterThan ( double a, double b ){ if ( a > b + EPS ) return true;	else return false;}

bool greaterThanEqual ( double a, double b ){ if ( a + EPS > b ) return true;	else return false;}



int kase;



/*--------------------------------------------------------------------------------------------------------------------------*/



void solution () {

	int n;

	cin >> n;

	vi a (n), b (n), c (n);

	vector <vector <int> > dp (n + 1, vector <int> (3, 0));

	

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

		cin >> a[i] >> b[i] >> c[i];

	}

	

	for (int i = n - 1; i >= 0; --i) {

		dp[i][0] = max (b[i] + dp[i + 1][1], c[i] + dp[i + 1][2]);

		dp[i][1] = max (a[i] + dp[i + 1][0], c[i] + dp[i + 1][2]);

		dp[i][2] = max (a[i] + dp[i + 1][0], b[i] + dp[i + 1][1]);

	}

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

}



int main() {

	FASTIO;

	// freopen ("out.txt", "w", stdout);

	int tc;

	// cin >> tc;

	tc = 1;

	

	while (tc--) {

		solution ();

	}

	

    return 0;

}



/*

 * check corner cases

 * be careful before submitting in Lightoj, SPOJ, UVA

*/