// Slower C++ solution:
/*

██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗

██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗

█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║

██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║

██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝

╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝

Believe in yourself ,( try and try and then try ), You can do it 

*/

#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

#include<unordered_map>

#define endl "\n"

#define Ceil(x,y) ((x+y-1)/y)

#define clr(arr, x) memset(arr, x, sizeof arr)

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

#define allr(s) s.rbegin(),s.rend()

#define rt(s) return cout<<s,0

#define watch(x) cout<<(#x)<<" = "<<x<<endl

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

#define OO 0x3f3f3f3f3f3f3f3fLL

const int oo = 0x3f3f3f3f, mod = 1e9 + 7;

using namespace std;

typedef long long ll;

typedef long double ld;

typedef unsigned long long ull;

//x = xDegrees*3.14159265 / 180;

//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);

//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));

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

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

void K_K(){

#ifndef ONLINE_JUDGE

//	freopen("in.txt", "r", stdin);

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

#endif  !ONLINEJUDGE

	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}

ll gcd(ll a, ll b) {

	return b == 0 ? abs(a) : gcd(b, a % b);

}

ll lcm(ll a, ll b) {

	return a / gcd(a, b) * b;

}

int n;

vector<int>a, b, c;

int dp[100005][5];

int sol(int idx, int pre){

	if (idx == n)

		return 0;

	int& ret = dp[idx][pre];

	if (~ret)

		return ret;

	int ch1 = 0, ch2 = 0, ch3 = 0;

	if (pre != 1)

		ch1 = sol(idx + 1, 1) + a[idx];

	if (pre != 2)

		ch2 = sol(idx + 1, 2) + b[idx];

	if (pre != 3)

		ch3 = sol(idx + 1, 3) + c[idx];

	return ret = max({ ch1, ch2, ch3 });

}

int main(){

	K_K();

	cin >> n;

	a.resize(n);

	b.resize(n);

	c.resize(n);

	clr(dp, -1);

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

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

	cout << sol(0, 0);

}

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

using namespace std;

#define ll long long

#define io ios_base::sync_with_stdio(false);cin.tie(NULL)

//the function below is used to input integars(int) quickly;int a=readInt();

int readInt () {

	bool minus = false;

	int result = 0;

	char ch;

	ch = getchar();

	while (true) {

		if (ch == '-') break;

		if (ch >= '0' && ch <= '9') break;

		ch = getchar();

	}

	if (ch == '-') minus = true; else result = ch-'0';

	while (true) {

		ch = getchar();

		if (ch < '0' || ch > '9') break;

		result = result*10 + (ch - '0');

	}

	if (minus)

		return -result;

	else

		return result;

}



ll bigpow(ll base,ll pw,ll M)

{

	if(pw==0) return 1;

	if(pw%2==0)

	{

		ll ret=bigpow(base,pw/2,M);

		return ((ret%M)*(ret%M))%M;

	}

	else return ((base%M)*(bigpow(base,pw-1,M)))%M;



}

ll maxi(ll a,ll b)

{

    if(a>b)return a;

    return b;

}

ll mini(ll a,ll b)

{

    if(a<b)return a;

    return b;

}

ll abse(ll a)

{

    if(a<0)return -a;

    return a;

}

ll ceili(ll a,ll div)

{

    return (a+div-1)/div;

}

int dp[100005][3]={0};

int ara[100005][3];

int N;

int f(int i,int row)

{

    if(row>=N)return 0;

    if(i>2)i-=3;

    if(dp[row][i])return dp[row][i];

    return dp[row][i]= maxi(ara[row][i]+f(i+1,row+1),ara[row][i]+f(i+2,row+1));



}

int main(void)

{

    io;

    int t;

    t=1;

    while(t--)

    {

        N=readInt();

        int i,j;

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

        {

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

                ara[i][j]=readInt();

        }

        ll ans=maxi(f(0,0),maxi(f(1,0),f(2,0)));

        cout<<ans;



    }

}