#include<bits/stdc++.h>
using namespace std;
#define endl '\n'

const int N = 1e5;

int dp[N+5][4];
int arr[N+5][4];

int main(){

	ios_base::sync_with_stdio(0);
	int n; cin >>n;
	for(int i = 1; i<=n; i++){
		cin >>arr[i][1] >>arr[i][2] >>arr[i][3];
	}

	for(int i = 1; i<=n; i++){
		dp[i][1] = arr[i][1] + max(dp[i-1][2], dp[i-1][3]);
		dp[i][2] = arr[i][2] + max(dp[i-1][1], dp[i-1][3]);
		dp[i][3] = arr[i][3] + max(dp[i-1][1], dp[i-1][2]);
	}	

	cout <<max({dp[n][1], dp[n][2], dp[n][3]}) <<endl;
	return 0;
}