// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

#include<iostream>

#include<algorithm>

#include<iomanip>

#include<string>

#include<cmath>

#include<vector>

#include<set>

#include<queue>

#include<stack>

#include<fstream>

#include<map>

#include<bitset>

#include<unordered_map>

#include<cstring>

#include<cctype>

using namespace std;

#define  ll long long

#define  ull unsigned long long

#define  ul unsigned long

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

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

#define pb(s) push_back(s);

#define format(n) fixed<<setprecision(n)

#define finl "\n"

#define Mohammed_Atef_Hassan fast();

#define mod 1000000007

#define INF LLONG_MAX

#define PI acos(-1)

#define clr(dp,n) memset(dp,n,sizeof dp)

#define ex(n) return cout<<n<<finl,0;

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

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

ll fix_mod(ll x, ll y)

{

	return (y + x % y) % y;

}

void fast() {

	std::ios_base::sync_with_stdio(false);

	cin.tie(nullptr); cout.tie(nullptr);





}

int n;

vector<vector<ll>>v;

ll mem[(int)1e5 + 10][5];

ll solve(int i, int c)

{

	if (i == n)return 0;

	ll& ret = mem[i][c];

	if (~ret)return ret;

	for (int k = 0; k < 3; k++)

	{

		if (k == c)continue;

		ret = max(ret, solve(i+1, k) + v[i][k]);

	}

	return ret;

}

int main()

{

	Mohammed_Atef_Hassan

		cin >> n;

	v = vector<vector<ll>>(n + 1, vector<ll>(3));

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

		cin >> v[i][0] >> v[i][1] >> v[i][2];

	clr(mem, -1);

	ex(solve(0, 4));

}

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

using namespace std;

//#pragma gcc optimize("O3")

//#pragma gcc optimize("unroll-loops")

#ifdef EVAH

    #define _WIN32_WINNT 0x0500

    //#include<windows.h>

#endif

#define openFile(n) ShellExecute(nullptr,"open",n,nullptr,nullptr,SW_SHOWNORMAL);

#define closeP(n) system((string("taskkill /im ")+n+" /f").c_str());

#define closeConsole PostMessage(GetConsoleWindow(), WM_CLOSE, 0, 0);

#define opf "output.txt"

#define ipf "input.txt"

#define mem(n,x) memset(n,x,sizeof(n));

#define sf scanf

#define pf printf

#define ff first

#define ss second

#define pb push_back

#define PII pair<int,int>

#define PLL pair<LL,LL>

#define For(x,n) for(int i=x; i<n; i++)

#define stv v+2*(mid-tl+1)

#define LL long long int

#define N 100001



LL dp1[N],dp2[N],dp3[N];



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr); cout.tie(nullptr);

    #ifdef EVAH

        //freopen(ipf,"r",stdin);

        //openFile(ipf);

        //closeConsole;

        //freopen(opf,"w",stdout);

    #endif



    LL n;

    cin >> n;

    vector<LL> one(n),two(n),three(n);

    For(0,n) cin >> one[i] >> two[i] >> three[i];

    dp1[0]=one[0],dp2[0]=two[0],dp3[0]=three[0];

    For(1,n) {

        dp1[i] = one[i]+max(dp2[i-1],dp3[i-1]);

        dp2[i] = two[i]+max(dp1[i-1],dp3[i-1]);

        dp3[i] = three[i]+max(dp1[i-1],dp2[i-1]);

    }

    cout << max(dp1[n-1],max(dp2[n-1],dp3[n-1])) << "\n";



    #ifdef EVAH

        //openFile(opf);

        //Sleep(3000);

        //closeP("notepad.exe");

        //closeConsole;

    #endif

}