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



#define ll long long

#define ull unsigned long long

#define ld long double



#define tiii tuple < int, int, int >

#define pii pair < int, int >

#define pll pair < ll, ll >

#define pci pair < char, int >

#define psi pair < string, int >

#define pis pair < int, string >



#define vi vector < int >

#define vd vector < double >

#define vld vector < ld >

#define vll vector < ll >

#define vs vector < string >

#define vc vector < char >

#define vpi vector < pii >

#define vpll vector < pll >

#define vpis vector < pis >



#define pb push_back

#define mt make_tuple

#define gt0 get < 0 >

#define gt1 get < 1 >

#define gt2 get < 2 >



#define pi acos(-1)



#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)



using namespace std;



const int maxn = 1e5 + 5;

const int mod = 1e9 + 9;



ll a[maxn], b[maxn], c[maxn], f[maxn][5];



int main()

{

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

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



    fast;



    int n;



    cin >> n;



    for(int i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];



    f[1][1] = a[1];

    f[1][2] = b[1];

    f[1][3] = c[1];



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

        f[i][1] = max(f[i - 1][2], f[i - 1][3]) + a[i];

        f[i][2] = max(f[i - 1][1], f[i - 1][3]) + b[i];

        f[i][3] = max(f[i - 1][1], f[i - 1][2]) + c[i];

    }



    cout << max(f[n][1], max(f[n][2], f[n][3])) << endl;



    return 0;

}