#include<bits/stdc++.h>
using namespace std;
const int maxm=4;
int f[2][maxm],N,a,b,c;
int main()
{
	memset(f,0,sizeof(f));
	cin>>N;
	for(int i=1;i<=N;++i)
	{
		cin>>a>>b>>c;
		f[i%2][1]=max(f[(i-1)%2][2],f[(i-1)%2][3])+a;
		f[i%2][2]=max(f[(i-1)%2][1],f[(i-1)%2][3])+b;
		f[i%2][3]=max(f[(i-1)%2][1],f[(i-1)%2][2])+c;
	}
	cout<<max(f[N%2][1],max(f[N%2][2],f[N%2][3]));
	return 0;
 } 