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

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

const int N = 1e5+10 , OO = 0x3f3f3f3f ;

//const int mod = 1000000007;

 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double startTime;

double getCurrentTime() {

	return ((double)clock() - startTime) / CLOCKS_PER_SEC;

}

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

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

#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)

#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)

#define range(vec) for(auto &x : vec) cin >> x;

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

#define SZ(v)  ((int)((v).size()))

int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction

//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction

//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction

//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

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

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



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

int dp[N][4];



int solve(int idx , int lst){

	

	if(idx == n) return 0;

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

	if(~ret) return ret;

	ret = -OO;

	if(lst != 0) // swim

		ret = max(ret , solve(idx+1 , 0) + a[idx]);

	if(lst != 1)

		ret = max(ret , solve(idx+1 , 1) + b[idx]);

	if(lst != 2)

		ret = max(ret , solve(idx+1 , 2) + c[idx]);

		

	return ret;

}





int main()

{

    startTime = (double)clock();

    #ifndef ONLINE_JUDGE

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

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

    #endif

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

	

	cin >> n;

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

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



	clr(dp , -1);

	cout << solve(0 , 3) << "\n";





    return 0;

}

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

#include <algorithm>

#include <climits>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

#include <iostream>

#include <math.h>

using namespace __gnu_pbds;

using namespace std;

#define ll long long

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> pbds;

#define vll vector<ll> 

#define nl cout << endl

#define fr(a,b) for(auto i=a;i<b;i++)

#define pll pair<ll,ll>

#define f first

#define s second

#define vpll vector<pll>

#define ump unordered_map

#define YES cout << "YES" << endl

#define NO cout << "NO" << endl

#define IN(a,b) ((a).find(b)!=(a).end())

#define pb push_back

#define mkp make_pair

#define PI M_PI

#define INF 1e18

#define deb(x) if(ON) cout << #x <<" : " << x << endl

#define fast ios_base::sync_with_stdio(false)

#define io cin.tie(NULL),cout.tie(NULL)

#define ON !false

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

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

const ll mod=1e9+7;

ll i,j;

ll add(ll a,ll b){

    return  ((a%mod)+(b%mod)+mod)%mod;

}

ll mul(ll a,ll b){

    return ((a%mod)*(b%mod)+mod)%mod;

}

void pause(ll id){

    cout << "Waiting " << id << endl;

    cin >> id;

}



const int mxn=1e5+10;

ll n,t;





signed main(){

    fast;

    io;

    if(!true){

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

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

    }

    ll n;

    cin >> n;

    ll arr[n+1][3];

    ll i,j;

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

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

            arr[i][j]=0;

        }

    }

    ll a,b,c;

    ll mx=-INF;

    for(i=1;i<=n;i++){

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

            cin >> arr[i][j];

            mx=max((arr[i-1][(j+1)%3]),(arr[i-1][(j+2)%3]));

            arr[i][j]+=mx;

        }

    }

    mx=max(arr[n][0],max(arr[n][1],arr[n][2]));

    cout << mx << endl;

    return 0;

}