// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;













#define pf                  printf

#define sf(a)               scanf("%d",&a)

#define sfl(a)              scanf("%lld",&a)

#define sff(a,b)            scanf("%d %d",&a,&b)

#define sffl(a,b)           scanf("%lld %lld",&a,&b)

#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)

#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)

#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)

#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)

#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)

#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)

#define sfc(a)              scanf("%c",&a)

#define pii                 pair<int,int>

#define ms(a,b)             memset(a,b,sizeof(a))

#define pb(a)               push_back(a)

#define pbp(a,b)            push_back({a,b})

#define db                  double

#define ft                  float

#define ll                  long long

#define ull                 unsigned long long

#define pii                 pair<int,int>

#define ff                  first

#define ss                  second

#define sz(x)               x.size()

#define all(x)              x.begin(),x.end()

#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)

#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)

#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)

#define for0(i,n)           for(int i=0;i<n;i++)

#define for1(i,n)           for(int i=1;i<=n;i++)

#define forrev(i,n)         for(int i=n-1; i>=0; i--)

#define forab(i,a,b)        for(int i=a;i<=b;i++)

#define forba(i,b,a)        for(int i=b;i>=a;i--)

#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)

#define gcd(a, b)           __gcd(a, b)

#define lcm(a, b)           ((a)*((b)/gcd(a,b)))

#define case1(z)            cout<<"Case "<<z<<": "

#define case2(z)            printf("Case %d: ",z)

#define PI                  acos(-1) //3.14159265358979323846264338328

#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col

#define intlim              2147483648

#define N                   100005

#define inf                 100000008

#define mod                 1000000007



/*------------------------------Graph Moves----------------------------*/

//const int fx[]={+1,-1,+0,+0};

//const int fy[]={+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*---------------------------------------------------------------------*/















int main()

{

    ll n,i,j,x;

    ll a[N][4],dp[N][4];

    cin>>n;

    for(i=0;i<n;i++)

    {

        for(j=0;j<3;j++)

        {

            cin>>a[i][j];

        }

    }

    for(i=0;i<n;i++)

    {

        for(j=0;j<3;j++)

        {

            if(i==0)

            {

                dp[i][j]=a[i][j];

            }

            else

            {

                if(j==0)

                {

                    dp[i][j]=max(dp[i-1][1]+a[i][j],dp[i-1][2]+a[i][j]);

                }

                else if(j==1)

                {

                    dp[i][j]=max(dp[i-1][0]+a[i][j],dp[i-1][2]+a[i][j]);

                }

                else

                {

                    dp[i][j]=max(dp[i-1][1]+a[i][j],dp[i-1][0]+a[i][j]);

                }

            }

        }

    }

    //for(i=0;i<n;i++)

    //{

    //    for(j=0;j<3;j++)

    //    {

    //        cout<<dp[i][j]<<" ";

    //    }

    //    cout<<endl;

    //}

    x=max(dp[n-1][0],dp[n-1][1]);

    x=max(x,dp[n-1][2]);

    cout<<x<<endl;

	return 0;

}
































































// Faster C++ solution for the same problem (measured speedup: 1.1500233594481966x):
#include <bits/stdc++.h>

using namespace std;

#define INF 2000000000

typedef long long int ll;

typedef pair<ll,ll> ii;

typedef vector<ll> vi;

typedef vector<ii> vii;

#define getbit(n,i) (((n)&(1<<(i)))!=0)

#define setbit0(n,i) ((n)&(~(1<<(i))))

#define setbit1(n,i) ((n)(1<<(i)))

#define togglebit(n,i) ((n)^(1<<(i)))

#define lastone(n) ((n)&(-(n)))

#define read freopen("debug\\in.txt","r",stdin)

#define write freopen("debug\\out.txt","w",stdout)

#define fi first

#define se second

#define getI(a) scanf("%d",&a)

#define getII(a,b) scanf("d",&a,&b)

#define PI (acos(-1))

#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)

#define mod (1000000007)

#define asz 500005

#define t int t;scanf("%d",&t);for(int v=1;v<=t;v++)

#define loop_arr(i,a,b) for(int i=a;i<b;i++)

#define loop_norm(i,a,b) for(int i=a;i<=b;i++)

#define minheap priority_queue<int,vector<int>,greater<int> >

#define maaheap priority_queue<int>

#define pb push_back

#define newl "\n"

ll BIGMOD ( ll a, ll p, ll m )

{

    ll result = 1;

    ll x = a;



    while ( p )

    {

        if ( p & 1 ) //p is odd

        {

            result = ( result * x ) % m;

        }

        x = ( x * x ) % m;

        p = p >> 1;

    }



    return result;

}



bool isPrime(int n)

{

    if (n <= 1)  return false;

    if (n <= 3)  return true;

    if (n%2 == 0 || n%3 == 0) return false;



    for (int i=5; i*i<=n; i=i+6)

        if (n%i == 0 || n%(i+2) == 0)

           return false;



    return true;

}



void SieveOfEratosthenes(int n)

{

    bool prime[n+1];

    memset(prime, true, sizeof(prime));



    for (int p=2; p*p<=n; p++)

    {



        if (prime[p] == true)

        {

            for (int i=p*p; i<=n; i += p)

                prime[i] = false;

        }

    }

}

const int MAX=100005;

ll memo[MAX][3];

 int arr[MAX][3];

 int n;

 void init()

 {

     for(int i=0;i<=n;i++)

     {

         for(int j=0;j<3;j++) memo[i][j]=-1;

     }

 }

ll vacation(int i,char current)

{

    if(i==n) return 0;

    if(memo[i][current-'A']!=-1) return memo[i][current-'A'];

    if(current=='A')

    {

        ll res1=arr[i][0]+vacation(i+1,'B');

        ll res2=arr[i][0]+vacation(i+1,'C');

        return memo[i][0]=max(res1,res2);

    }

    if(current=='B')

    {

        ll res1=arr[i][1]+vacation(i+1,'A');

        ll res2=arr[i][1]+vacation(i+1,'C');

        return memo[i][1]=max(res1,res2);

    }

    if(current=='C')

    {

        ll res1=arr[i][2]+vacation(i+1,'A');

        ll res2=arr[i][2]+vacation(i+1,'B');

        return memo[i][2]=max(res1,res2);

    }





}



int main()

{

  // fastread;

   cin>>n;

   init();

   for(int i=0;i<n;i++)

   {

       for(int j=0;j<3;j++) cin>>arr[i][j];

   }

   ll res1=vacation(0,'A');

   ll res2=vacation(0,'B');

   ll res3=vacation(0,'C');

   cout<<max(res1,max(res2,res3))<<newl;

  return 0;

}