#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;
const int MAXN = 1e5 + 5;

int n;
long long ans;
long long dp[MAXN][5];//第i天看a ／b ／c的最大幸福值.
struct node{
	int a, b, c;
}node[MAXN];

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		node[i].a = a;
		node[i].b = b;
		node[i].c = c;
	}
	dp[1][1] = node[1].a;
	dp[1][2] = node[1].b;
	dp[1][3] = node[1].c;
	for(int i = 2; i <= n; i++){
		dp[i][1] = max(dp[i-1][2]+node[i].a, dp[i-1][3]+node[i].a);
		dp[i][2] = max(dp[i-1][1]+node[i].b, dp[i-1][3]+node[i].b);
		dp[i][3] = max(dp[i-1][2]+node[i].c, dp[i-1][1]+node[i].c);

	}
	ans = dp[n][1];
	for(int i = 2; i <= 3; i++){
		ans = max(ans, dp[n][i]);
	}
	printf("%lld\n", ans);
	return 0;
}