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

typedef long long  int ll;

#define s(t) scanf("%I64d",&t)
#define s2(t,t1) scanf("%I64d%I64d",&t,&t1)


ll n,a[100005][3];
int main()
{
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i][0]>>a[i][1]>>a[i][2];
        a[i][0]+= max(a[i-1][1],a[i-1][2]);
        a[i][1]+= max(a[i-1][0],a[i-1][2]);
        a[i][2]+= max(a[i-1][1],a[i-1][0]);

    }
    cout<<max(a[n][2],max(a[n][0],a[n][1]))<<endl;



}
