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

#define ll long long

#define Test int t;cin>>t;while(t--)

#define PI acos(-1)

#define endl "\n"

#define fx(x) fixed<<setprecision(x)

#define sz(s) s.size()

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

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

const double eps=1e-9;

const int mod=1e9+7;

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

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

ll gcd(ll x,ll y) {return(!y)?x:gcd(y,x%y);}

ll lcm(ll x,ll y) {return((x/gcd(x,y))*y);}

using namespace std;

void fast(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

}

const int N=(int)1e5+10;

int dp[3][N];

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

int solve(int p,int idx){

    if(idx==n)return 0;

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

    if(ret)return ret;

    if(p==0)ret=a[idx];

    else if(p==1)ret=b[idx];

    else ret=c[idx];

    idx++;

    if(p==0)ret+=max(solve(1,idx),solve(2,idx));

    else if(p==1)ret+=max(solve(0,idx),solve(2,idx));

    else if(p==2)ret+=max(solve(0,idx),solve(1,idx));

    return ret;

}

int main()

{

    fast();

    cin>>n;

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

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

    }

    int ans;

    ans=max({solve(0,0),solve(1,0),solve(2,0)});

    cout<<ans;

    return 0;

}