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

#define ull unsigned long long

#define ll long long

#define pb push_back

#define endl '\n'

#define line cout<<"----------------------"<<endl

#define mp make_pair

#define mod 1000000007

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

#define filein freopen("input.txt","r",stdin)

#define fileout freopen("output.txt","w",stdout)

using namespace std;

const ll  mx=300009;

struct edge

{

    ll  a,b,c;

};

vector<edge> v;

ll  dp[100009][4];

ll  call(ll  ind, ll  pre)

{

    if(ind==v.size()) return 0;

    ll  &ret=dp[ind][pre];

    if(ret!=-1) return ret;

    ret=0;

    ll  a=0,b=0,c=0;

    auto x=v[ind];

        if(pre==1)

        {

            a=x.b+call(ind+1,2);

            b=x.c+call(ind+1,3);

        }

        else if(pre==2)

        {

            a=x.a+call(ind+1,1);

            b=x.c+call(ind+1,3);

        }

        else if(pre==3)

        {

            a=x.a+call(ind+1,1);

            b=x.b+call(ind+1,2);

        }

        else

        {

            a=x.a+call(ind+1,1);

            b=x.b+call(ind+1,2);

            c=x.c+call(ind+1,3);

        }

    return ret=max(a,max(b,c));

}

int  main()

{

    ll  n ;

    cin>>n;

    for(ll  i=0;i<n;i++)

    {

        ll  a,b,c; cin>>a>>b>>c;

        v.pb({a,b,c});

    }

    memset(dp,-1,sizeof dp);

    cout<<call(0,0)<<endl;







}


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



using namespace std;



int choose(const int &day, const int &last_activity, const int activities[][3], const int &n, int memo[][4]){

    int ans;

    if(day == n){

        ans = 0;

    }

    else{

        if(memo[day][last_activity] != -1){

            ans = memo[day][last_activity];

        }

        else if(last_activity == 0){

            ans = memo[day][0] = max(activities[day][0] + choose(day + 1, 1, activities, n, memo), max(activities[day][1] + choose(day + 1, 2, activities, n, memo), activities[day][2] + choose(day + 1, 3, activities, n, memo)));

        }

        else if(last_activity == 1){

            ans = memo[day][1] = max(activities[day][1] + choose(day + 1, 2, activities, n, memo), activities[day][2] + choose(day + 1, 3, activities, n, memo));

        }

        else if(last_activity == 2){

            ans = memo[day][2] = max(activities[day][0] + choose(day + 1, 1, activities, n, memo), activities[day][2] + choose(day + 1, 3, activities, n, memo));

        }

        else{

            ans = memo[day][3] = max(activities[day][0] + choose(day + 1, 1, activities, n, memo), activities[day][1] + choose(day + 1, 2, activities, n, memo));

        }

    }

    return ans;

}



int solve(const int activities[][3], const int &n, int memo[][4]){

    return choose(0, 0, activities, n, memo);

}



int main(){

    int n;

    while(scanf("%d", &n) != EOF){

        int activities[n][3], memo[n][4];

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

            scanf("%d %d %d", &activities[i][0], &activities[i][1], &activities[i][2]);

            memo[i][0] = -1; memo[i][1] = -1; memo[i][2] = -1; memo[i][3] = -1;

        }

        printf("%d\n", solve(activities, n, memo));

    }

    return 0;

}