#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	int a[n][3];
	cin>>a[0][0]>>a[0][1]>>a[0][2];
	for(int i=1;i<n;i++)
	{cin>>a[i][0]>>a[i][1]>>a[i][2];
	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]));
	return 0;
}