#include<bits/stdc++.h>
using namespace std;
long long int a[100005];
long long int b[100005];
long long int c[100005];

int main()
{
    int i,j,n,m,t;
    cin>>t;
    for(i=1;i<=t;i++){
        cin>>a[i]>>b[i]>>c[i];
        a[i]=a[i]+max(b[i-1],c[i-1]);
        b[i]=b[i]+max(a[i-1],c[i-1]);
        c[i]=c[i]+max(b[i-1],a[i-1]);
    }
    cout<<max(max(a[t],b[t]),c[t])<<endl;
}
