// 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.650947283046728x):
#include<bits/stdc++.h>

using namespace std;

 

#define             ll  long long

#define            ull  unsigned long long

#define            P_B  push_back

#define            M_P  make_pair

#define         DBG(x)  printf("%s %d\n", #x, x)

#define       DBGLL(x)  printf("%s %lld\n", #x, x)

#define         SCI(x)  scanf("%d",&x)

#define         SCD(x)  scanf("%lf",&x)

#define         SCS(x)  scanf("%s",x)

#define         CLR(x)  memset(x, 0, sizeof(x))

#define        CLRN(x)  memset(x, -1, sizeof(x))

#define        SCLL(x)  scanf("%lld", &x)

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

#define  FORR(i, m, n)  for(int i = m; i < n; i++)

#define     SCI2(m, n)  scanf("%d%d", &m, &n)

#define  SCI3(m, n, o)  scanf("%d%d%d",&m, &n, &o)

#define     SCD2(m, n)  scanf("%lf%lf",&m,&n)

#define  SCD3(m, n, o)  scanf("%lf%lf%lf",&m,&n,&o)

#define    SCLL2(m, n)  scanf("%lld%lld", &m, &n)

#define SCLL3(m, n, o)  scanf("%lld%lld%lld",&m, &n, &o)

#define             vi  vector<int>

#define            vii  vector<pair<int, int> >

#define            vll  vector<pair<ll, ll> >

#define            Mod  998244353

#define            INF  1000000000

 



int a[100005][4];

int n;



int main()

{

	SCI(n);

	FOR(i, n)

		FOR(j, 3)

			SCI(a[i][j]);

	FORR(i, 1, n){

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

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

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

	}

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

}