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

using namespace std;



// Optimization

//#pragma optimize ("O3")

#define endl '\n'



// Shortcut



#define int long long

#define eb emplace_back

#define pb push_back

#define pob pop_back

#define mp make_pair

#define upb upper_bound

#define lwb lower_bound

#define fi first

#define se second

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

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

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

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

#define Fora(i, a) for (auto i : a)



// I/O & Debug



#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';

#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;

#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';

#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;

#define Ptest(x) return cout << x, 0;

#define gl(s) getline(cin, s);

#define setpre(x) fixed << setprecision(x)

/*

#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }

void DEB(istream_iterator<string> it) {}

template<typename T, typename... Args>

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

    cout << *it << " = " << a << endl;

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

}

*/



// Functions



//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')

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

#define rbend(a) a.rbegin(), a.rend()

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

#define m1set(a) memset(a, 1, sizeof(a))

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

#define mmset(a) memset(a, 0x3f, sizeof(a))

#define gcd __gcd

#define __builtin_popcount __builtin_popcountll

//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());



// Data Structure



#define pque priority_queue

#define mts multiset

#define y0 _y0_

#define y1 _y1_

#define div divi

typedef long long ll;

typedef long double ld;

typedef vector <int> vi;

typedef vector <ll> vll;

typedef vector <ld> vld;

typedef vector <string> vs;

typedef pair <int, int> pii;

typedef pair <ll, ll> pll;

typedef vector <vi > vvi;

typedef vector <vll > vvll;

typedef vector <pii > vpii;

typedef vector <pll > vpll;



const int N = 3e5 + 5, base = 26, mod = 1e9 + 9, inf = 1e9 + 7;



int n;

int a[N], b[N], c[N], da[N], db[N], dc[N];



signed main(){

    ios_base::sync_with_stdio(0);

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

    cin >> n;

    ForE(i, 1, n){

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

    }

    da[1] = a[1];

    db[1] = b[1];

    dc[1] = c[1];

    ForE(i, 2, n){

        da[i] = a[i] + max(db[i - 1], dc[i - 1]);

        db[i] = b[i] + max(dc[i - 1], da[i - 1]);

        dc[i] = c[i] + max(da[i - 1], db[i - 1]);

    }

    cout << max(da[n], max(db[n], dc[n]));

}



/*

==================================+

INPUT:                            |

------------------------------    |



------------------------------    |

==================================+

OUTPUT:                           |

------------------------------    |



------------------------------    |

==================================+

*/

// Faster C++ solution for the same problem (measured speedup: 5.267821953472515x):
#include <cstdio>

#include <algorithm>

using std::max;



#define MAXN 100003

int d[MAXN][3],a[MAXN][3];

int main(void)

{

    int i,N;

    scanf("%d",&N);

    for(i=0;i<N;i++)

    {

        scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);

    }

    d[0][0]=a[0][0];

    d[0][1]=a[0][1];

    d[0][2]=a[0][2];

    for(i=1;i<N;i++)

    {

        d[i][0]=a[i][0]+max(d[i-1][1],d[i-1][2]);

        d[i][1]=a[i][1]+max(d[i-1][0],d[i-1][2]);

        d[i][2]=a[i][2]+max(d[i-1][1],d[i-1][0]);

    }

    printf("%d\n",max(d[N-1][0],max(d[N-1][1],d[N-1][2])));



    return 0;

}