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

using namespace std;



#define ff              first

#define ss              second

#define ll             long long

#define pb              push_back

#define mp              make_pair

#define pii             pair<ll,ll>

#define vi              vector<ll>

#define mii             map<ll,ll>

#define pqb             priority_queue<ll>

#define pqs             priority_queue<ll,vi,greater<ll> >

#define setbits(x)      __builtin_popcountll(x)

#define zrobits(x)      __builtin_ctzll(x)

#define mod             1000000007

#define inf             1e18

#define ps(x,y)         fixed<<setprecision(y)<<x

#define mk(arr,n,type)  type *arr=new type[n];

#define w(x)            ll x; cin>>x; while(x--)

#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)



struct activity{

ll A,B,C;};



ll solve(ll n,vector<activity>v){

    ll dp[n+1][3];

dp[1][0]=v[1].A;

dp[1][1]=v[1].B;

dp[1][2]=v[1].C;

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

{

    dp[i][0]=v[i].A+max(dp[i-1][1],dp[i-1][2]);

    dp[i][1]=v[i].B+max(dp[i-1][0],dp[i-1][2]);

    dp[i][2]=v[i].C+max(dp[i-1][1],dp[i-1][0]);

}



return max(dp[n][0],max(dp[n][1],dp[n][2]));



}



int main()

{

    FIO;

    ll a,b,c,d,e,f=0,sum=0,ans,ck=0,m,n,k,p,q,r,t,add=0,x,y,z;



    string s;



    cin>>n;

    vector<activity>v(n+1);

    for(int i=1;i<=n;i++){cin>>v[i].A;cin>>v[i].B;cin>>v[i].C;}

    ans=solve(n,v);

    cout<<ans<<endl;







    return 0;

}