#include<bits/stdc++.h>
using namespace std;
int max_points(int *a , int *b, int *c , int n, int *dp, int cur_act){
//base case
if(n==0){
return 0;
}
//look up
if(dp[n]!=-1){
return dp[n];
}
int op1 = INT_MIN;
int op2 = INT_MIN;
int op3 = INT_MIN;
if(cur_act!=1){
op1 = max_points(a,b,c,n-1,dp,1) + a[n];
//cout<<op1<<endl;
}
if(cur_act!=2){
op2 = max_points(a,b,c,n-1,dp,2) + b[n];
//cout<<op2<<endl;
}
if(cur_act!=3){
op3 = max_points(a,b,c,n-1,dp,3) + c[n];
//cout<<op3<<endl;
}
return dp[n] = max(op1, max(op2,op3));
}
int main(){
int n; cin>>n;
int a[n],b[n],c[n];
a[0]=b[0]=c[0] = 0;
for(int i=1;i<=n;i++){
cin>>a[i]>>b[i]>>c[i];
}
int dp[n+1];
for(int i=0;i<=n;i++){
dp[i]=-1;
}
/for(int i=1;i<=n;i++){
cout<<a[i]<<" “<<b[i]<<” "<<c[i]<<endl;
}/
cout<<max_points(a,b,c,n,dp,0);
return 0;
}