#include<bits/stdc++.h>
using namespace std;
int n,a[100002],b[100002],c[100002];
long long fA[100002],fB[100002],fC[100002];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	for(int i=1;i<=n;i++){
		fA[i]=max(fB[i-1],fC[i-1])+a[i];
		fB[i]=max(fA[i-1],fC[i-1])+b[i];
		fC[i]=max(fB[i-1],fA[i-1])+c[i];
	}
	cout<<max(max(fA[n],fB[n]),fC[n]);
}