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

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

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

 #define mod 1000000007

 #define INF  1e9+5

 #define f first

 #define se second

 #define endl '\n'

 #define ll long long

 #define ii pair <int,int>

 #define pll pair <ll,ll>

 #define vi vector <int>

 #define vl vector <ll>

 #define vvi vector < vi >

 #define vii vector < ii >

 #define vvii vector < vii >

 #define vll vector < ll >

 #define mi map<int,int>

 #define mll map<ll,ll>

 #define mci map<char,int>

 #define msi map<string,int>

 #define vb  vector <bool>

 #define pb push_back

 #define mk make_pair

 #define sz(a) a.size()

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

 #define rall(a) a.rbegin(),a.rend()

 #define int long long int

 #define Anurag_Gupta ios_base::sync_with_stdio(false);

#define IIIT_ALLD    cin.tie(NULL);cout.tie(NULL);

using namespace std;

vi fact(1000007);

inline int mdpower(int a,int b)

{

    int res =1;

    while(b)

    {

        if(b&1) res = (res%mod*a%mod)%mod;

        b/=2;

        a = (a%mod*a%mod)%mod;

    }

    return res;

}

inline int power(int a,int b)

{

    int res =1;

    while(b)

    {

        if(b&1) res = (res*a);

        b/=2;

        a = a*a;

    }

    return res;

}



inline void factorial()

{

    fact[0]=1;

    for(int i=1;i<1000007;i++)

        fact[i] = (fact[i-1]%mod*i%mod)%mod;

}



inline int inverse(int a)

{

    return mdpower(a,mod-2);

}

int n;

int arr[100005][3];

int dp[100005][3];

 signed main()

 {

     Anurag_Gupta

     IIIT_ALLD

     

     // #ifndef ONLINE_JUDGE

     //     freopen("input.txt","r",stdin);

     //     freopen("output.txt","w",stdout);

     // #endif



         cin>>n;

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

         {

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

         		cin>>arr[i][j];

         }



         dp[0][0]=dp[0][1]=dp[0][2]=0;

         dp[1][0]=arr[1][0];

         dp[1][1]=arr[1][1];

         dp[1][2]=arr[1][2];



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

         {

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

         	{

         		if(j==0)

         		{

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

         		}

         		else if(j==1)

         		{

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

         		}

         		else

         		{

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

         		}

         	}

         }



         cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));

 }



//dp[i][j] = maximum fun upto day i when she choses jth activity on day i;


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

#define f first

#define se second

#define pb push_back

#define pf push_front

#define eb emplace_back

#define emp emplace

#define ins insert

#define sz(s) (int)s.size()

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

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

#define bitcount __builtin_popcount

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

#define rall(v) v.rbegin(),v.rend()

#define mem(n,m) memset(n,m,sizeof(n))

#define ii pair<int,int>

#define iii tuple<int, int, int>

#define si set<int>

#define vi vector<int>

#define vii vector<ii>

#define mi map<int,int>

#define lb lower_bound

#define ub upper_bound

#define present(s,x) (s.find(x) != s.end())

#define ford(container, it) for(auto it:container)

#define fors(container, it, a, b) for(auto it = a; it != b; it++)

#define Raag4924 ios_base::sync_with_stdio(0);

#define fastio cin.tie(0);cout.tie(0);

#define mod 987654319

#define EPSILON 1e-9

#define PI acos(-1)

#define inf 1e17

#define int long long

#define debug(a) cerr<<#a<<": ";for(auto i:a)cerr<<i<<" ";cerr<<'\n';

#define trace(a) cerr<<#a<<": "<<a<<"\n"

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

using namespace std;

int add(int a, int b, int c){int res=a+b;return(res>=c?res-c:res);}

int mod_neg(int a, int b, int c){int res;if(abs(a-b)<c)res=a-b;else res=(a-b)%c;return(res<0?res+c:res);}

int mul(int a, int b, int c){int res=(int)a*b;return(res>=c?res%c:res);}

template<typename T>T power(T e, T n){T x=1,p=e;while(n){if(n&1)x=x*p;p=p*p;n>>=1;}return x;}

template<typename T>T mdpower(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=mul(x,p,m);p=mul(p,p,m);n>>=1;}return x;}

template<typename T>T extended_euclid(T a, T b, T &x, T &y){T xx=0,yy=1;y=0;x=1;while(b){T q=a/b,t=b;b=a%b;a=t;\

t=xx;xx=x-q*xx;x=t;t=yy;yy=y-q*yy;y=t;}return a;}

template<typename T>T mod_inverse(T a, T n){T x,y,z=0;T d=extended_euclid(a,n,x,y);return(d>1?-1:mod_neg(x,z,n));}

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



int32_t main()

{

    Raag4924

    fastio

 

  

  

    int n;

    cin>>n;



    int arr[n+1][3];



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

        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];



    int dp[n+1][3];



    memset(dp,0,sizeof dp);



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

    dp[1][i] = arr[1][i];



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

    {

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

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

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



    }

 

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

 













 

#ifndef LOCAL_DEFINE

        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

    #endif

}