#include<iostream>
#include<cmath>
using namespace std;

int main(){
	int n; cin>>n;
  	long a=0,b=0,c=0; long x,y,z; long  ta,tb,tc;
  	for(int i=0; i<n; i++){
      cin>>x>>y>>z;
      ta=x+max(b,c); tb=y+max(a,c); tc=z+max(a,b);
      a=ta; b=tb; c=tc;
    }
  	cout<<max(a,max(b,c))<<endl;
}
