// 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.6144311012940373x):


#include<bits/stdc++.h>

using namespace std;

#define ll long long



int main()

{

        ll N;

        cin>>N;

        ll A[N]={},B[N]={},C[N]={};

        ll i,j,k;



      ll  bal[N][3]={};





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

                        cin>>A[i]>>B[i]>>C[i];



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

                                if(i==0){

                                        if(j==0)bal[i][0]=bal[i][0]+A[i];

                                        else if(j==1)bal[i][1]=bal[i][1]+B[i];

                                        else bal[i][2]=bal[i][2]+C[i];

                                }

                                else {

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

                                                if(j==k)continue;

                                                else if(j==0){

                                                            bal[i][j]=max(bal[i][j],bal[i-1][k]+A[i]);

                                                                }

                                                else if(j==1){

                                                          bal[i][j]=max(bal[i][j],bal[i-1][k]+B[i]);

                                                }

                                                else{

                                                        bal[i][j]=max(bal[i][j],bal[i-1][k]+C[i]);

                                                }

                                        }

                                }

                }

        }

        //cout<<bal[N-1][0]<<" "<<bal[N-1][1]<<" "<<bal[N-1][2];



        ll xx=max(bal[N-1][0],bal[N-1][1]);

        xx=max(xx,bal[N-1][2]);



        cout<<xx<<endl;

        return 0;

}