// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <cstdlib>

using namespace std;

template<class T> inline bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}

template<class T> inline bool chmax(T& a, T b) {

    if (a < b) {

        a = b;

        return true;

    }

    return false;

}

const long long INF = 1LL << 60;

long long dp[100100][3];

int main(void){

	

    int N;cin>>N;

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

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

          dp[i][j]=0;

        }

    }

	long long h[N+100][3]={0};

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

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

        	cin>>h[i][j];

        }

	}

    dp[0][0]=h[0][0];

	dp[0][1]=h[0][1];

	dp[0][2]=h[0][2];



    for(int i=1;i<N;i++){

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

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

        		if(j==k)continue;

                chmax(dp[i][j],dp[i-1][k]+h[i][j]);

                

            }

        }

    }

    long long output;output=0;

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

    	chmax(output,dp[N-1][i]);

    }

                  

    cout<<output<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define ll long long

#define ull unsigned long long

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

#define REP(a,b) for(int a=0;a<(b);++a)

#define REP1(i,n) for(int i=1;i<=(n);++i)

#define debug(x) cerr<<#x<<": "<<x<<'\n'

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

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

#define pb push_back

#define mp make_pair

#define INF (1<<29)

using namespace std;

typedef pair<int, int> P;

typedef pair<ll, ll> LP;

typedef pair<int, P> PP;

typedef pair<ll, LP> LPP;



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

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



template<class T=int>

T in(){T x;cin>>x;return (x);}

template<class T>

void print(T& x){cout<<x<<'\n';}



const int MOD =(int)1e9+7;

const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];

void COMint(){

    fac[0]=fac[1]=1;

    finv[0]=finv[1]=1;

    inv[1]=1;

    for(int i=2;i<MAX;i++){

        fac[i]=fac[i-1]*i%MOD;

        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;

        finv[i]=finv[i-1]*inv[i]%MOD;

    }

}

ll COM(int n,int k){

    if(n<k) return 0;

    if(n<0||k<0)return 0;

    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;

}

ll gcd(ll a,ll b){

    if(b==0)return a;

    if(a>b){

        swap(a,b);

    }

    return gcd(a,b%a);

}

ll lcm(ll a,ll b){

    ll g;g=gcd(a,b);

    return a*b/g;

}

bool compare_by_b(pair<int, int> a, pair<int, int> b) {

    if(a.second != b.second){

        return a.second < b.second;

    }else{

        return a.first < b.first;

    }

}



bool compare_by_a(pair<int, int> a, pair<int, int> b) {

    if(a.first != b.first){

        return a.first < b.first;

    }else{

        return a.second < b.second;

    }

}

template<class T> inline bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}

template<class T> inline bool chmax(T& a, T b) {

    if (a < b) {

        a = b;

        return true;

    }

    return false;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    int N=in();

    int a[N];

    int b[N];

    int c[N];

    REP(i,N){

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

    }

    vector<vector<ll>> vec;

    vector<ll> v;

    v.assign(3,0);

    vec.assign(N+1,v);

    REP(i,N){

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

        vec[i+1][1]=max(vec[i][0]+b[i],vec[i][2]+b[i]);

        vec[i+1][2]=max(vec[i][0]+c[i],vec[i][1]+c[i]);

        

    }

    cout<<max(vec[N][0],max(vec[N][1],vec[N][2]))<<endl;

    return 0;

}

// Fastest known solution for this problem: