// Slower C++ solution:
/*input

7

6 7 8

8 8 3

2 5 2

7 8 6

4 6 8

2 3 4

7 5 1

*/



#include <functional>

#include <algorithm>

#include <iostream>

#include <string.h>

#include <utility> 

#include <iomanip>

#include <string>

#include <vector>

#include <math.h>

#include <map>

#include <set>



using namespace std;



using ll = long long;

using ld = long double;



const int SINF = 1000000009;

const ll INF =  1000000000000000018;



#define sp          cout << " "

#define nl          cout << "\n"

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

#define prec(n)     cout << fixed << setprecision(n)

#define PI          3.14159265358979323846264338327951

#define ifalse      ios_base::sync_with_stdio(false), cin.tie(NULL)



template <typename T, typename U>

ostream &operator<<(ostream &os, const pair<T, U> &p) {

  os << p.first << " " << p.second;

  return os;

}



template <typename T, typename U>

istream &operator>>(istream &is, pair<T, U> &p) {

  is >> p.first >> p.second;

  return is;

}



template <typename T>

ostream &operator<<(ostream &os, const vector<T> &v) {

  for(auto x: v) {

    os << x << " ";

  }

  return os;

}



template <typename T>

istream &operator>>(istream &is, vector<T> &v) {

  for (auto &x : v) is >> x;

  return is;

}



/******************************** START *********************************/

const int N = 100005;

vector < vector < int > > v;

int dp[N][4];



int func(int n, int prev)

{

  if(n == 0) {

    return 0;

  }

  if(dp[n][prev] > -1) {

    return dp[n][prev];

  }



  int res = 0;

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

    if(i == prev) continue;

    res = max(res, v[n - 1][i] + func(n - 1, i));

  }

  return dp[n][prev] = res;

}



int main()

{

  ifalse;

  int n;

  cin >> n;

  v.assign(n, vector < int >(3, 0));

  cin >> v;



  memset(dp, -1, sizeof(dp));

  cout << func(n, 3);

  return 0;

}

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

3

10 40 70

20 50 80

30 60 90

*/



#include <functional>

#include <algorithm>

#include <iostream>

#include <string.h>

#include <utility> 

#include <iomanip>

#include <string>

#include <vector>

#include <math.h>

#include <map>

#include <set>



using namespace std;



using ll = long long;

using ld = long double;



const int SINF = 1000000009;

const ll INF =  1000000000000000018;



#define sp          cout << " "

#define nl          cout << "\n"

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

#define prec(n)     cout << fixed << setprecision(n)

#define PI          3.14159265358979323846264338327951

#define ifalse      ios_base::sync_with_stdio(false), cin.tie(NULL)



template <typename T, typename U>

ostream &operator<<(ostream &os, const pair<T, U> &p) {

  os << p.first << " " << p.second;

  return os;

}



template <typename T, typename U>

istream &operator>>(istream &is, pair<T, U> &p) {

  is >> p.first >> p.second;

  return is;

}



template <typename T>

ostream &operator<<(ostream &os, const vector<T> &v) {

  for(auto x: v) {

    os << x << " ";

  }

  return os;

}



template <typename T>

istream &operator>>(istream &is, vector<T> &v) {

  for (auto &x : v) is >> x;

  return is;

}



/******************************** START *********************************/

const int N = 100005;

vector < vector < int > > v;

int dp[N][4];



int func(int n, int prev)

{

  if(n == 0) {

    return 0;

  }

  if(dp[n][prev] > -1) {

    return dp[n][prev];

  }



  int res = 0;

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

    if(i == prev) continue;

    res = max(res, v[n - 1][i] + func(n - 1, i));

  }

  return dp[n][prev] = res;

}



int main()

{

  ifalse;

  int n;

  cin >> n;

  v.assign(n, vector < int >(3, 0));

  cin >> v;



  int dp[n][3] = {0};

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

    dp[0][i] = v[0][i];

  }  



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

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

      for(int k = 0; k < 3; k ++) {

        if(j == k) continue;

        dp[i][j] = max(dp[i][j], v[i][j] + dp[i - 1][k]);

      }

    }

  }

  int res = 0;

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

    res = max(res, dp[n - 1][i]);

  }

  cout << res, nl;

  return 0;

}