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

#include <algorithm>

#include <iostream>

#include <iomanip>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cstring>

#include <vector>

#include <string>

#include <climits>

#include <map>

#include <set>

#include <stack>

#include <queue>

#include <deque>

#include <stdio.h>

//#define int long long

using namespace std;

#define loop(n) for(int i=0;i<n;i++)

#define endl '\n'

#define OnlineJudgec

#define F first

#define S second

#define  precision(n)  cout << fixed << setprecision(n)

#define clr(v,d ) memset(v, d, sizeof(v))

typedef long long ll;

typedef vector<int> vi;

void init()

{

    cin.tie(0);

    cin.sync_with_stdio(0);

    cout.tie(0);

    #ifdef OnlineJudge

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

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

    #endif

}

ll S(ll x){ll s = 0;while(x){s += x % 10;x /= 10;}return s;} /// sum of digits.

ll powe(ll a , ll n){if(n == 1)return a;return a * powe(a ,n-1);}

ll com(int n,int m){ll z = 1;for(int i = 0; i < m;i++){z = z * ( n - i) / (i + 1) ;}return z;}

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

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

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

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

/// <<------------------------------------------------------------------------------>>

const int mx = 100009;

int n , k;

int arr[mx][4];

int dp[mx][4];

int solve(int idx , int last)

{

     if(idx == n)return 0;

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

     if(~ret) return ret;

     int A = 0 ,B = 0 ,C = 0;

     if(last != 0)

        A = solve(idx+1 , 0) + arr[idx][0];

     if(last != 1)

        B = solve(idx+1 , 1) + arr[idx][1];

     if(last != 2)

        C = solve(idx+1 , 2) + arr[idx][2];

     return ret = max(A,max(B,C));

}

/// <<------------------------------------------------------------------------------>>

int main()

{

    init();

    cin >> n;

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

    {

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

    }

    clr(dp,-1);

    cout<<solve(0,3);

}


// Faster C++ solution for the same problem (measured speedup: 2.61265314770768x):
#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;



    }

}