#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>  
using namespace std;

#define ll                  long long int
#define new1(n)             ll  n;cin>>n;
#define new2(n,k)           ll  n,k;cin>>n>>k;
#define new3(a,b,c)         ll a,b,c;cin>>a>>b>>c;
#define new4(a,b,c,d)       ll  a,b,c,d;cin>>a>>b>>c>>d;
#define fl(n,i)             for(ll  i=0;i<n;i++)
#define revfl(n)            for(ll i=n-1;i>=0;i--)
#define getMax(a,n)         *max_element(a,a+n);
#define getMin(a,n)         *min_element(a,a+n);
#define lb(a,n,v)           lower_bound(a,a+n,v)-a;
#define ub(a,n,v)           upper_bound(a,a+n,v)-a;
#define rsort(a,n)          sort(a,a+n,greater<long long int >());
#define fast                ios_base::sync_with_stdio(false);cin.tie(NULL);
#define takeA(a,n)          ll  a[n];fl(n,i)cin>>a[i];
#define takeV(c,n)          vector<ll>c;fl(n,i){new1(x);c.push_back(x);}
#define printA(a,n)         fl(n)cout<<a[i]<<" ";
#define printV(v,n)         fl(n)cout<<v[i]<<" ";
#define pair(a,b)           make_pair(a,b)
#define union(a,b,un)       set_union(a.begin(),a.end(),b.begin(),b.end(),insert_iterator<set<int> >(un,un.begin()));
#define intersec(a,b,in)    set_intersection(a.begin(),a.end(),b.begin(),b.end(),insert_iterator<set<int> >(in,in.begin()));
#define mod                 1000000007
#define checkk              cout<<"Yes "
#define test                ll t;cin>>t;while(t--)
#define all(v)              v.begin(),v.end() 

ll arr1[100005],arr2[100005],arr3[100005];
ll n,k,z=0;
ll matrix[100005][4];

ll func(ll index,ll prev)
{
    if(index==0)
    {
        if(prev==1)
        return max(arr2[0],arr3[0]);
        if(prev==2)
        return max(arr1[0],arr3[0]);
        if(prev==3)
        return max(arr1[0],arr2[0]);
        else
        return max(arr1[0],max(arr2[0],arr3[0]));
    }
    if(prev==1)
    {
        if(matrix[index-1][2]==-1)
        matrix[index-1][2]=func(index-1,2);
        if(matrix[index-1][3]==-1)
        matrix[index-1][3]=func(index-1,3);
        matrix[index][1]=max(matrix[index-1][2]+arr2[index],matrix[index-1][3]+arr3[index]);
        return matrix[index][1];
    }
    if(prev==2)
    {
        if(matrix[index-1][1]==-1)
        matrix[index-1][1]=func(index-1,1);
        if(matrix[index-1][3]==-1)
        matrix[index-1][3]=func(index-1,3);
        matrix[index][2]=max(matrix[index-1][1]+arr1[index],matrix[index-1][3]+arr3[index]);
        return matrix[index][2];
    }
    if(prev==3)
    {
        if(matrix[index-1][1]==-1)
        matrix[index-1][1]=func(index-1,1);
        if(matrix[index-1][2]==-1)
        matrix[index-1][2]=func(index-1,2);
        matrix[index][3]=max(matrix[index-1][1]+arr1[index],matrix[index-1][2]+arr2[index]);
        return matrix[index][3];
    }
    
    
        if(matrix[index-1][1]==-1)
        matrix[index-1][1]=func(index-1,1);
        if(matrix[index-1][2]==-1)
        matrix[index-1][2]=func(index-1,2);
        if(matrix[index-1][3]==-1)
        matrix[index-1][3]=func(index-1,3);
    return max(matrix[index-1][1]+arr1[index],max(matrix[index-1][2]+arr2[index],matrix[index-1][3]+arr3[index]));
}

int main()  
{  
    fast;
    memset(matrix,-1,sizeof(matrix));
    cin>>n;
    fl(n,i) cin>>arr1[i]>>arr2[i]>>arr3[i];
    cout<<func(n-1,-1);
    return 0; 
}


Measured memory_bytes: 13800