#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define ll          long long
#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
#define track(x)                cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))
#define MOD         1000000007
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); }
void self_min(int &a, int &b) {a = min(a, b); }
#define hell        1000000007
bool isPrime(long int n) 
{
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    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; 
}

long long power1(long long N, long long expo)
{
    long long ans = 1;
    
    while(expo)
    {
        if(expo % 2) {
            ans = ans * N % MOD;
            ans = ans % 10;
        }
        
        N = N * N % MOD;
        N = N % 10;
        expo /= 2;
    }
    
    return ans;
}

long long power(long long N, long long expo)
{
    long long ans = 1;
    
    while(expo)
    {
        if(expo % 2) {
            ans = ans * N % MOD;
        }
        
        N = N * N % MOD;
        expo /= 2;
    }
    
    return ans;
}
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) { 
    return (a.second < b.second); 
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


int n, k, a, b, c;

int dp[100005][3];
void solve(){
	cin >> n;

	rep(i, 0, n) {
		cin >> a >> b >> c;
		if(!i)	dp[i][0] = a, dp[i][1] = b, dp[i][2] = c;
		else {
			dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a;
			dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b;
			dp[i][2] = max(dp[i - 1][1], dp[i - 1][0]) + c;
		}
	}

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


}	
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
}



Measured memory_bytes: 1408