// Slower C++ solution:
#include <iostream>

#include <queue>

#include <string>

#include <map>

#include <stdio.h>

#include <iomanip>

#include <math.h>

#include <vector>

#include <stack>

#include <algorithm>

#include <string.h>

#include <set>

#include <cstdlib>

#include <iostream>

#include <bits/stdc++.h>

#define pii pair<int,int> 

#define ll long long int 

#define sl(n) scanf("%lld",&n)

#define s(n) scanf("%d",&n)

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

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

#define fnm(n,m) for(ll i=n;i<m+1;++i)

#define pb push_back

#define pf printf

#define F first

#define S second

#define srt(v) sort(v.begin(),v.end());

#define srtc(v,cmp) sort(v.begin(),v.end(),cmp);

#define srta(v,n) sort(v,v+n);

const ll LL_INF=0x3f3f3f3f3f3f;

const ll MOD=1073741824;





using namespace std;





int T;

int d,arr[100005][5];

int dp[100005][5];



int gen(int i,int prev){ // swim:0, bugs:1, homework:2

    if(i == d)return 0;

    int &ret = dp[i][prev];

    if(~ret)return ret;

    ret = gen(i+1,(prev+1)%3)+arr[i][(prev+1)%3];

    ret = max( ret , gen(i+1,(prev+2)%3)+arr[i][(prev+2)%3]);

    if(!i)ret = max( ret , gen(i+1,(prev)%3)+arr[i][(prev)%3]);

    return ret;

}



int main(){

    // pf("\t\t\t***************************************************************************\n\n");

    // pf("\t\t\t***************************************************************************\n\n");

    // freopen("input.txt","r",stdin);

    // freopen("output.txt","w",stdout);

    memset(dp,-1,sizeof dp);

    s(d);

    f(i,d){

        s(arr[i][0]);

        s(arr[i][1]);

        s(arr[i][2]);

    }

    pf("%d\n",gen(0,0));



    return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 2.9454358013622786x):
#include<bits/stdc++.h>

using namespace std;

//#pragma gcc optimize("O3")

//#pragma gcc optimize("unroll-loops")

#ifdef EVAH

    #define _WIN32_WINNT 0x0500

    //#include<windows.h>

#endif

#define openFile(n) ShellExecute(nullptr,"open",n,nullptr,nullptr,SW_SHOWNORMAL);

#define closeP(n) system((string("taskkill /im ")+n+" /f").c_str());

#define closeConsole PostMessage(GetConsoleWindow(), WM_CLOSE, 0, 0);

#define opf "output.txt"

#define ipf "input.txt"

#define mem(n,x) memset(n,x,sizeof(n));

#define sf scanf

#define pf printf

#define ff first

#define ss second

#define pb push_back

#define PII pair<int,int>

#define PLL pair<LL,LL>

#define For(x,n) for(int i=x; i<n; i++)

#define stv v+2*(mid-tl+1)

#define LL long long int

#define N 100001



LL dp1[N],dp2[N],dp3[N];



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr); cout.tie(nullptr);

    #ifdef EVAH

        //freopen(ipf,"r",stdin);

        //openFile(ipf);

        //closeConsole;

        //freopen(opf,"w",stdout);

    #endif



    LL n;

    cin >> n;

    vector<LL> one(n),two(n),three(n);

    For(0,n) cin >> one[i] >> two[i] >> three[i];

    dp1[0]=one[0],dp2[0]=two[0],dp3[0]=three[0];

    For(1,n) {

        dp1[i] = one[i]+max(dp2[i-1],dp3[i-1]);

        dp2[i] = two[i]+max(dp1[i-1],dp3[i-1]);

        dp3[i] = three[i]+max(dp1[i-1],dp2[i-1]);

    }

    cout << max(dp1[n-1],max(dp2[n-1],dp3[n-1])) << "\n";



    #ifdef EVAH

        //openFile(opf);

        //Sleep(3000);

        //closeP("notepad.exe");

        //closeConsole;

    #endif

}