// Slower C++ solution:
#ifndef _GLIBCXX_NO_ASSERT

#include <cassert>

#endif

#include <cctype>

#include <cerrno>

#include <cfloat>

#include <ciso646>

#include <climits>

#include <clocale>

#include <cmath>

#include <csetjmp>

#include <csignal>

#include <cstdarg>

#include <cstddef>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>



#if __cplusplus >= 201103L

#include <ccomplex>

#include <cfenv>

#include <cinttypes>

#include <cstdbool>

#include <cstdint>

#include <ctgmath>

#include <cwchar>

#include <cwctype>

#endif



// C++

#include <algorithm>

#include <bitset>

#include <complex>

#include <deque>

#include <exception>

#include <fstream>

#include <functional>

#include <iomanip>

#include <ios>

#include <iosfwd>

#include <iostream>

#include <istream>

#include <iterator>

#include <limits>

#include <list>

#include <locale>

#include <map>

#include <memory>

#include <new>

#include <numeric>

#include <ostream>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <stdexcept>

#include <streambuf>

#include <string>

#include <typeinfo>

#include <utility>

#include <valarray>

#include <vector>



#if __cplusplus >= 201103L

#include <array>

#include <atomic>

#include <chrono>

#include <condition_variable>

#include <forward_list>

#include <future>

#include <initializer_list>

#include <mutex>

#include <random>

#include <ratio>

#include <regex>

#include <scoped_allocator>

#include <system_error>

#include <thread>

#include <tuple>

#include <typeindex>

#include <type_traits>

#include <unordered_map>

#include <unordered_set>

#endif





using namespace std;



#define ld long double

#define ll long long int

#define vi vector<int>

#define vll vector<ll>

#define vvi vector < vi >

#define pii pair<int,int>

#define pll pair<long long, long long>

#define vpll vector < pair<long long,long long> >

#define fill(a,val)  memset(a,val, sizeof (a))

#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))

#define mp make_pair

#define pb push_back

#define f first

#define se second

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

#define max3(a,b,c) max(a,max(b,c))

#define min3(a,b,c) min(a,min(b,c))

#define MAX   1e9

#define MIN  -1e9

typedef map<int,int> mpi;

typedef set<int> seti;

typedef multiset<int> mseti;

typedef priority_queue<int> pq;

typedef tuple< int , int, int > tup;

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

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

#define repA(i, a, n)  for(int i = a; i <= (n); ++i)

#define repD(i, a, n)  for(int i = a; i >= (n); --i)

#define trav(a, x) for(auto& a : x)

#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)

#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define PI 3.14159265



#define mod 1000000007



struct node{

    ll val;

};



struct Interval {int start, end;};

bool compare(struct node n1, struct node n2) {

    return (n1.val < n2.val);

}



const ll INF = 1e18+3;

const ll inf = 1e9+5;

const ll maxn = 1e6+2;



int main()

{

    ll n; cin>>n; ll dp[100001][3]={inf};

    ll a,b,c; cin>>a>>b>>c; dp[0][0]=a; dp[0][1]=b; dp[0][2]=c;

    repA(i,1,n-1)

    {

        cin>>a>>b>>c;

        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][0],dp[i-1][1]) + c;

    }

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

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 3.0783915197514884x):
/*input

7

6 7 8

8 8 3

2 5 2

7 8 6

4 6 8

2 3 4

7 5 1

*/

 

 

#include <bits/stdc++.h>

 

using namespace std;

 

#define ld long double

#define ll long long int

#define vi vector<int>

#define vll vector<ll>

#define vvi vector < vi >

#define pii pair<int,int>

#define pll pair<long long, long long>

#define vpll vector < pair<long long,long long> >

#define fill(a,val)  memset(a,val, sizeof (a))

#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))

#define mp make_pair

#define pb push_back

#define f first

#define se second

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

#define max3(a,b,c) max(a,max(b,c))

#define min3(a,b,c) min(a,min(b,c))

#define MAX   1e9

#define MIN  -1e9

typedef map<long long int, long long int> mpi;

typedef set<long long int> seti;

typedef multiset<long long int> mseti;

typedef priority_queue<long long int> pq;

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

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

#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)

#define repD(i, a, n)  for(ll i = a; i >= (n); --i)

#define trav(a, x) for(auto& a : x)

#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)

#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define PI 3.14159265

#define dbg(x) cerr << "\n" << (#x) << " = " << (x) << endl ;

//#define cerr if(false)cerr

  

struct node{

    ll val;

};

struct Interval {int start, end;};

bool compare(struct node n1, struct node n2) {

    return (n1.val < n2.val);

}

 

 

 ll gcd(ll a, ll b) 

{ 

    if (b == 0) 

        return a; 

    return gcd(b, a % b);  

      

} 























int main() 

{

	ll n; cin>>n;

	ll a[100005];

	ll b[100005];

	ll c[100005];

	repA(i,1,n){cin>>a[i]>>b[i]>>c[i];}

	ll dpa[100005];

	ll dpb[100005];

	ll dpc[100005];

	dpa[1] = a[1];

	dpb[1] = b[1];

	dpc[1] = c[1];



	repA(i,2,n){

		dpa[i] = max(dpb[i-1], dpc[i-1]) + a[i];

		dpb[i] = max(dpa[i-1], dpc[i-1]) + b[i];

		dpc[i] = max(dpb[i-1], dpa[i-1]) + c[i];

	}

	cout<<max(max(dpa[n], dpb[n]), dpc[n])<<endl;

    return 0;  

}