// Slower C++ solution:
/**       In the name of Allah, the Gracious, the Merciful.

*               Praise be to Allah, Lord of the Worlds.

*               **************************************

*

*    I have not failed, I have just found 1000 WAYS that won't work.

*                 __________________________________

*                  Author  : Abd El-Twab  M. Fakhry

*                 __________________________________

*/



#include <ext/rope>

#include <bits/stdc++.h>

#include <ext/pb_ds/tree_policy.hpp>

#include <ext/pb_ds/assoc_container.hpp>



#define  print(arr, l, r)    for(int i = (l); i < (r); cout << arr[i++] << " \n"[i == r])

#define  read(arr, l, r)     for(int i = (l); i < (r); cin >> arr[i++])

#define  repr(i, r, l)       for (int i = r; i > l; i--)

#define  rep(i, l, r)        for (int i = l; i < r; i++)

#define  Unique(n)           (n).erase(unique(all(n)), (n).end())

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

#define  RT(n)               return cout << (n) << endl, 0;

#define  sz(a)               (int)a.size()

#define  endl                '\n'

#define  D(x)                cout << #x << " = " << (x) << '\n'

#define  F                   first

#define  S                   second

#define  PB                  push_back

#define  EB                  emplace_back

#define  lsb(x)              (x & -x)

#define  get(n)              find_by_order(n)

#define  sqrt(n)             sqrtl(n)

#define  pow(a, b)           powl(a, b)

#define  indexOf(n)          order_of_key(n)

#define  isPowerOfTwo(x)     (x && !(x & (x - 1)))



using namespace std;

using namespace __gnu_pbds;

using namespace __gnu_cxx;



typedef long long            ll;

typedef unsigned long long   ull;



/**---------------------->>  Constants  <<-----------------------**/



const double    Pi      = 2 * acos(0.0),    Euler = 2.71828182845904523536,

                Epsln   = 1e-9,           GoldenR = (1 + sqrtl(5.0)) / 2;



const ll        MgcPrim = 2305843009213693951;

const int       MxsZ    = (int)1e5 + 9,        oo = 0x3f3f3f3f,

 		        ModB2   = (1 << 30) + 7,   ModBT7 = (int)1e9 + 7, ModBT = (int)1e9;



/**---------------->>  Functions & Shortcuts  <<-----------------**/



template <class T>

T Gcd(T a, T b) { return b ? Gcd(b, a % b) : a; }



template <class T>

T Lcm(T a, T b) { return a / Gcd(a, b) * 1ll * b; }



template <class T> /** Phi(a * b) = Phi(a) * Phi(b) where a and b Prime Factors and k their power **/

T Phi(T a, T k) { return pow(a, k - 1) * (a - 1); }



template <class T>

using indexed_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update >;



template <class T>

using matrix = vector < vector <T> >;



template <class T>

using min_heap = priority_queue < T, vector <T>, greater <T> >;



/** Watch **/



template <class T>

string ToString(T x) { stringstream sout; sout << x; return sout.str(); }



#ifdef BFS

int dx8[8] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dx4[4] = { 0, 0, 1,-1};

int dy8[8] = { 0, 0, 1, -1, 1, -1, 1, -1 }, dy4[4] = { 1,-1, 0, 0};

#endif // BFS



/**------------------>>  Fast input / output  <<-----------------**/



void Fast()

{

    cin.sync_with_stdio(0);

    cin.tie(0);cout.tie(0);

    cin.exceptions(cin.failbit);

}



/**----------------->>  input / output Files  <<-----------------**/



void File()

{

    #ifdef FIO

    freopen("input.in", "r", stdin);

    freopen("output.out", "w", stdout);

   	#endif // FIO

}



/**------------------>>  Initialization gap  <<------------------**/



int n, a[MxsZ][4], dp[MxsZ][4], mx = -oo;



int Vac(int nx, int type)

{

    if(nx < 0) return 0;

    int &ret = dp[nx][type];

    if(~ret) return ret;



    if(type == 1) return ret = a[nx][type] + max(Vac(nx - 1, 2), Vac(nx - 1, 3));

    if(type == 2) return ret = a[nx][type] + max(Vac(nx - 1, 1), Vac(nx - 1, 3));

    if(type == 3) return ret = a[nx][type] + max(Vac(nx - 1, 2), Vac(nx - 1, 1));

}



inline void Solve()

{

    cin >> n;

    rep(i, 0, n) cin >> a[i][1] >> a[i][2] >> a[i][3];



    rep(i, 1, 4)

    {

        memset(dp, -1, sizeof dp);

        mx = max(mx, Vac(n - 1, i));

    }

    cout << mx << endl;

}



/**------------------------->>  Main  <<-------------------------**/



int main()

{

    Fast(); File(); Solve();

}


// Faster C++ solution for the same problem (measured speedup: 3.63703026558375x):
#include<bits/stdc++.h>

#include<iostream>

#include<vector>

#include<algorithm>

#include<map>



using namespace std;



const int N=100500;

int OO=INT_MAX;

int n,a[N],b[N],c[N];

int mem[N][4];

int many=0;



int solve(int idx,int last)

{

    if(idx==n)

        return 0;

    if(mem[idx][last]!=-1)

        return mem[idx][last];

    int op1=-OO,op2=-OO;

    if(last==1)

    {

        op1=solve(idx+1,2)+b[idx];

        op2=solve(idx+1,3)+c[idx];

    }

    if(last==2)

    {

        op1=solve(idx+1,1)+a[idx];

        op2=solve(idx+1,3)+c[idx];

    }

    if(last==3)

    {

        op1=solve(idx+1,1)+a[idx];

        op2=solve(idx+1,2)+b[idx];

    }

    return mem[idx][last] = max(op1,op2);

}



int main() {



    cin>>n;

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

    {

        mem[i][1]=-1;

        mem[i][2]=-1;

        mem[i][3]=-1;

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

    }

    int fcall,scall,thcall;



    fcall=solve(1,1)+a[0];

    scall=solve(1,2)+b[0];

    thcall=solve(1,3)+c[0];



    cout<< max(fcall,max(scall,thcall));



	return 0;

}