#include<cstdio>
int f[2][3],n,a,b,c;
int ma(int a,int b){return a>b?a:b;}
int main()
{
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d%d%d",&a,&b,&c);
		f[n%2][0]=ma(f[(n+1)%2][1]+b,f[(n+1)%2][2]+c);
		f[n%2][1]=ma(f[(n+1)%2][0]+a,f[(n+1)%2][2]+c);
		f[n%2][2]=ma(f[(n+1)%2][0]+a,f[(n+1)%2][1]+b);
	}
	printf("%d",ma(f[0][0],ma(f[0][1],f[0][2])));
	return 0;
}
