codename
/*BISMILLAH UR RAHMAN*/
/* AUTHOR -CARLOSRAMIREZ *///Perfection is achieved only on the point of collapse
#include <bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define debug(x) std::cerr << #x << ": " << (x) << '\n';
#define sz(x) int(x.size())
#define INF INT_MAX;
using namespace std;
typedef long long int ll;
vector<tuple<int,int,int>> v(int(1e5+10));
int store[4][int(1e5+10)];
int dp(int n,int pre)
{
if(n<=0)return 0;
if(store[pre][n])return store[pre][n];
int ans=0,a,b,c;
tie(a,b,c)=v[n];
if(pre==1)
ans=max(b+dp(n-1,2),c+dp(n-1,3));
else if(pre==2)
ans=max(a+dp(n-1,1),c+dp(n-1,3));
else
ans=max(a+dp(n-1,1),b+dp(n-1,2));
return store[pre][n]=ans;
}
int main()
{
int n;cin>>n;
for(int i=1,x,y,z;i<=n;++i)
{
cin>>x>>y>>z;v[i]=make_tuple(x,y,z);
}
int ans=INT_MIN;
int a,b,c;
tie(a,b,c)=v[n];
vector<int> v1{a,b,c};
for(int i=1;i<=3;++i)
ans=max(ans,v1[i-1]+dp(n-1,i));
cout<<ans<<endl;
}