#include<bits//stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>a(n,0),b(n,0),c(n,0);
    for(int i=0;i<n;i++)
    cin>>a[i]>>b[i]>>c[i];
    
    for(int i=1;i<n;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[n-1],b[n-1]),c[n-1])<<endl;
}