// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



typedef long double LD;

typedef long long ll;

typedef map<int,int> mii;

typedef pair<int,int> pii;

typedef vector<pii> vpii;



#define pb              push_back

#define mp              make_pair

#define F               first

#define S               second

#define mod             1000000007

#define INF             2147483647

#define Endl            "\n"

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

#define precision(a)    cout << fixed << setprecision(a)

#define bug(a,b)        cout<<a<<"\t"<<b<<"\n";

#define Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";

#define reset(a,b)      memset(a,b,sizeof(a));

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



const int MAXN = 1000005;

const int SQRTN = 1003;

const int LOGN = 22;

const double PI=acos(-1);

const int sz=1e5+9;



int strtoint(string str){

    stringstream ss(str);

    int x = 0;

    ss >> x ;

    return x ;

}

string intostr(int x){

    stringstream ss;

    ss << x;

    string str = ss.str();

    return str;

}

void rem(string &s, const string &c) {

	auto pos = s.find(c);

	if (pos == string::npos) {

		cout << -1 << endl;

		exit(0);

	}

	s.erase(0, pos + 1);

}

void println (int n){

    cout<<n<<"\n";

}

void printvec(vector <int> &a){

    for (int i=0;i<a.size();i++){

        cout<<a[i]<<" ";

    }

    cout<<"\n";

}



void printgraph(vector <int> g[],int e){

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

        cout<<i<<" --> ";

        for (int j=0;j<g[i].size();j++){

            cout<<g[i][j]<<" ";

        }

        cout<<"\n";

    }

}



void printmap (map <int,int> &mymap){

    for (auto itr = mymap.begin(); itr != mymap.end(); ++itr) {

        cout << '\t' << itr->first

             << '\t' << itr->second << '\n';

    }

    cout << "\n";

}



int a[100005][4], dp[100005][4];

int N;



int rec(int pos, int type){



    if(pos>N) return 0;



    if(dp[pos][type]!=-1) return dp[pos][type];



    int ret = -1;

    for(int i=1; i<=3; i++)

        if(i!=type)

            ret = max (ret, rec(pos+1,i) + a[pos+1][i]);



    return dp[pos][type] = ret;

}





void solve(){

    memset(dp,-1,sizeof(dp));

    int i,j;

    cin>>N;

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

        for(j=1; j<=3; j++)

            cin>>a[i][j];





   cout<< rec(0,0) << "\n";



    //printvec(v);

}





int main(){

    //FasterIO;



    solve();

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1992242604443581x):
#include <iostream>

#include <queue>

#include <set>

#include <list>

#include <deque>

#include <vector>

#include <map>

#include <utility>

#include <algorithm>

#include <cmath>

#include <cstdio>

#include <string>

#include <iterator>

#define ll long long

#define pb push_back

#define pf push_front

#define ppb pop_back

#define ppf pop_front

#define powr(x,n,p) for(int axy=0 ; axy<p ; axy++){x=x*n;}

#define YES printf("YES\n")

#define Yes printf("Yes\n")

#define yes printf("yes\n")

#define NO printf("NO\n")

#define No printf("No\n")

#define no printf("no\n")

#define nl printf("\n")

#define fr0(n,q) for(q=0 ; q<n ; q++)

#define fr1(n,q) for(q=1 ; q<=n ; q++)

#define mp make_pair

#define scl(x) scanf("%lld",&x)

#define sci(x) scanf("%d",&x)

#define lst(x) x[x.size()-1]

#define llst(x) x[x.size()-2]

#define md 1000000007

#define check(x,y) (x&(1<<y))

#define set(x,y) x=x|(1<<y)

using namespace std;

int n;

int arr[100005][3],dp[100005][3];

int solve(int i, int j){

    if(i>n) return 0;

    if(dp[i][j]!=-1) return dp[i][j];

    int ret;

    if(j==0) ret=max(arr[i][j]+solve(i+1,1),arr[i][j]+solve(i+1,2));

    else if(j==1) ret=max(arr[i][j]+solve(i+1,0),arr[i][j]+solve(i+1,2));

    else ret=max(arr[i][j]+solve(i+1,0),arr[i][j]+solve(i+1,1));

    return dp[i][j]=ret;

}

int main()

{

        sci(n);

        int i,j;

        fr0(100005,i){

            fr0(3,j) dp[i][j]=-1;

        }

        for(i=1 ; i<=n ; i++){

            for(j=0 ; j<3 ; j++) sci(arr[i][j]);

        }

        int ans=max(solve(1,0),solve(1,1));

        ans=max(ans,solve(1,2));

        printf("%d\n",ans);

    return 0;

}