#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a=0,b=0,c=0;
	int a1,b1,c1;
	for(int i=0;i<n;i++){
		cin>>a1>>b1>>c1;
		a1=a1+max(b,c);
		b1=b1+max(a,c);
		c1=c1+max(a,b);
		a=a1;
		b=b1;
		c=c1;
	}
	cout<<max(max(a,b),c);
	return 0;
}