// Original C++ solution (slower):
#include <bits/stdc++.h>

#define ll long long 

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');

#define setbit(x,k) (x |= (1 << k))

#define clearbit(x,k) (x &= ~(1ll << k))

#define checkbit(x,k) (x & (1ll << k))

#define mp make_pair

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

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

#define pb push_back

#define pf push_front

#define ppb pop_back

#define ppf pop_front

#define pii pair<int,int> 

#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 nn printf("\n") 

#define mod 10000007

using namespace std;    



ll n, a[100005][3];

ll dp[100005][3][3];



ll solve(int pos, int konta, int koydin)

{

    if(pos == n) return 0;

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



    ll res = 0;

    if(koydin<1) res = max(res, a[pos][konta] + solve(pos+1, konta, koydin+1));

    if(konta == 0)

    {

        res = max(res, a[pos][1] + solve(pos+1, 1, 1));

        res = max(res, a[pos][2] + solve(pos+1, 2, 1));

    }

    if(konta == 1)

    {

        res = max(res, a[pos][0] + solve(pos+1, 0, 1));

        res = max(res, a[pos][2] + solve(pos+1, 2, 1));

    }

    if(konta == 2)

    {

        res = max(res, a[pos][1] + solve(pos+1, 1, 1));

        res = max(res, a[pos][0] + solve(pos+1, 0, 1));

    }

    return dp[pos][konta][koydin] = res;

}



int main()

{

    cin>>n;

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

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

    {

        cin>>a[i][0]>>a[i][1]>>a[i][2];

    }

    cout<<solve(0,2,0); nn;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

//#pragma gcc optimize("O3")

//#pragma gcc optimize("unroll-loops")

#ifdef EVAH

    #define _WIN32_WINNT 0x0500

    //#include<windows.h>

#endif

#define openFile(n) ShellExecute(nullptr,"open",n,nullptr,nullptr,SW_SHOWNORMAL);

#define closeP(n) system((string("taskkill /im ")+n+" /f").c_str());

#define closeConsole PostMessage(GetConsoleWindow(), WM_CLOSE, 0, 0);

#define opf "output.txt"

#define ipf "input.txt"

#define mem(n,x) memset(n,x,sizeof(n));

#define sf scanf

#define pf printf

#define ff first

#define ss second

#define pb push_back

#define PII pair<int,int>

#define PLL pair<LL,LL>

#define For(x,n) for(int i=x; i<n; i++)

#define stv v+2*(mid-tl+1)

#define LL long long int

#define N 100001



LL dp1[N],dp2[N],dp3[N];



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr); cout.tie(nullptr);

    #ifdef EVAH

        //freopen(ipf,"r",stdin);

        //openFile(ipf);

        //closeConsole;

        //freopen(opf,"w",stdout);

    #endif



    LL n;

    cin >> n;

    vector<LL> one(n),two(n),three(n);

    For(0,n) cin >> one[i] >> two[i] >> three[i];

    dp1[0]=one[0],dp2[0]=two[0],dp3[0]=three[0];

    For(1,n) {

        dp1[i] = one[i]+max(dp2[i-1],dp3[i-1]);

        dp2[i] = two[i]+max(dp1[i-1],dp3[i-1]);

        dp3[i] = three[i]+max(dp1[i-1],dp2[i-1]);

    }

    cout << max(dp1[n-1],max(dp2[n-1],dp3[n-1])) << "\n";



    #ifdef EVAH

        //openFile(opf);

        //Sleep(3000);

        //closeP("notepad.exe");

        //closeConsole;

    #endif

}


// Fastest known solution for this problem: