#include<bits/stdc++.h>
using namespace std;
#define int long long
// iteration and input/output stream
#define rep(i,a,b) for(int i = a;i<=b;i++)
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define printarr(x) rep(i,0,x.size()-1) cout<<x[i]<<" "; cout<<endl;
#define all(v) v.begin(),v.end()
 
#define si(x) int x; scanf("%d", &x)
#define sll(x) ll x; scanf("%lld", &x)
#define pi(x) printf("%d", x)
#define pll(x) printf("%lld", x)
#define nl printf("\n")
#define tr(cont,it) \
for(decltype(cont.begin()) it = cont.begin(); it!= cont.end() ; it++)
 
#define endl "\n"
#define tc() int t; cin >> t ; while (t--)
//STL shortcuts
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define F first
#define S second
#define MP make_pair
 
// Error detection
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
 
typedef long long ll; // 64 bit integer
typedef unsigned long long ull; // 64 bit unsigned integer
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;
 
inline void smax(int &x , int y) { x = max(x , y) ; }
inline void smin(int &x , int y) { x = min(x , y) ; }
 
#define MOD 1000000007
#define inf 4000000000000000000LL
#define SYNC std::ios::sync_with_stdio(false);  cin.tie(NULL);
 
vvi a;
vvi dp;

int f(int i,int flag)
{
    if(flag==0)
    {
        int maxi =0;
        for (int opt = 1; opt <= 3; opt++)
        {
            maxi = max(maxi,f(i-1,opt));
        }
        return maxi;
    }
    if(i<0) return 0;
    assert(flag!=0);
    if(dp[i][flag]!=-1) return dp[i][flag];
    if(i==0)
    {
        return dp[i][flag] = a[0][flag];
    }
    else
    {
        int maxi = 0;
        for (int k = 1; k <= 3; k++)
        {
            if(k!=flag)
            {
                maxi = max(maxi,f(i-1,k)+a[i][flag]);
            }
        }
        return dp[i][flag] = maxi;
    }
}
 
signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("err.txt","w",stderr);
    #endif
    SYNC
    int n;
    cin>>n;
    a.assign(n,vi(4,0));
    dp.assign(n,vi(4,-1));

    // return 0;
    for (int i = 0; i < n; i++)
    {   
        for (int j = 1; j <= 3; j++)
        {
            cin>>a[i][j];
        }
    }
    int ans = f(n,0);
    // for (int i = 0; i < n; i++)
    // {
    //     for (int j = 0; j < 4; j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<"\n";
    // }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 23520