/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int task[][] = new int[n][3];
		for(int i=0;i<n;i++){
			task[i][0]=sc.nextInt();
			task[i][1]=sc.nextInt();
			task[i][2]=sc.nextInt();
		}
		int dp[]=new int[3];
		dp[0]=task[0][0];dp[1]=task[0][1];dp[2]=task[0][2];
		for(int i=1;i<n;i++){
			int p0=dp[0];
			int p1=dp[1];
			int p2=dp[2];
			dp[0]=task[i][0]+Math.max(p1,p2);
			dp[1]=task[i][1]+Math.max(p0,p2);
			dp[2]=task[i][2]+Math.max(p0,p1);
		}
		int max = Math.max(dp[0],Math.max(dp[1],dp[2]));
		System.out.println(max);
	}
}