/*#include <bits/stdc++.h>
#define cross(a,b) (conj(a)*(b)).imag()
#define dot(a,b) (conj(a)*(b)).real()
#define ld long double
#define ll long long
#define vec(a,b) (b-a)
#define pi acos(-1)
//#define x real()
//#define y imag()


using namespace std;
typedef complex <ld> point;
typedef vector<point> polygon;
typedef tuple<int,int,int> line; // represents a b c of line

vector <ll> v;
//vector <ll> vc;

//ll mod = 1e9 +7;
//ll fact[1000005], inv[1000005];
//int p;


bool prime(ll n)
{
   if(n==1)
    return false;
   for(int i=2; i<=sqrt(n); ++i)
   {
       if(n%i==0)
       {
           return false;
       }
   }
   return true;
}

/*unsigned long long fp(ll x, ll y)
{
    if(y==0)
    {
        return 1;
    }
    ll z = fp(x,(y/2));

    if(y%2==0)
    {
        return (z*z)%p;
    }
    else
        return (((z*z)%p)*(x%p))%p;
}*/
/*unsigned long long fp(ll x, ll y)
{
    if(y==0)
    {
        return 1;
    }
    ll z = fp(x,(y/2));

    if(y%2==0)
    {
        return (z*z)%mod;
    }
    else
        return (((z*z)%mod)*(x%mod))%mod;
}
void pre()
{
  fact[0]=inv[0]=1;
  for(int i=1; i<=1000005; ++i)
  {
      fact[i]=(fact[i-1]*i)%mod;
      inv[i]=fp(fact[i], mod-2);
  }
}
unsigned ll ncr(int n, int r)
{
    return (((fact[n]*inv[n-r])%mod) * inv[r])%mod;
}*/

/*int main()
{
    //pre();
    int n, ans=0;
    ll c;
    cin >> n;
    for(int k=1; k<=n; ++k)
    {
        c=0;
        bool arr[30005]={false};
        if(prime(k))
            continue;
        for(ll i=1; i*i<=k; ++i)
        {
            if(k%i==0 && prime(i) && arr[i]==false)
            {
                c++;
                arr[i]=true;
            }
            if(k%i==0 && prime(k/i) && arr[k/i]==false)
            {
                    c++;
                    arr[k/i]=true;
            }
        }
        if(c==2)
            ans++;
    }
    cout << ans << endl;*/
/*cin >>p;
int cnt=0;
bool ch=1;
for(int i=1; i<p; ++i)
{
    ch=1;
    for(int j=1; j<=p-2; ++j)
    {
            if(((fp(i,j)-1)+p)%p==0)
            {
                ch=0;
            }
            if( ((fp(i,p-1)-1)+p)%p!=0)
            {
                ch=0;
            }
            if(!ch)
            {
                break;
            }
    }
    if(ch)
        cnt++;
}
cout << cnt << endl;*/
//return 0;
//}

#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;

const int N=1e5+5;
int ans[N][3];
int arr[N][3];
vector< vector<ll> > v(N);
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    for(int i=0; i<n; ++i)
    {
        for(int j=0; j<3; ++j)
        {
            cin >> arr[i][j];
        }
    }
    for(int i=0; i<3; ++i)
    {
        ans[0][i]=arr[0][i];
    }
    for(int i=1; i<n; ++i) //Days
    {
        for(int j=0; j<3; ++j) //Activities
        {
            int Max=1;
            for(int k=0; k<3; ++k)
            {
                if(j==k)
                    continue;
                Max=max(Max,ans[i-1][k]);
            }
            ans[i][j]=Max+arr[i][j];
        }
    }
    int Max=max(ans[n-1][0],max(ans[n-1][1],ans[n-1][2]));
    cout << Max << endl;
    return 0;
}





Measured memory_bytes: 4992