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