#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define vt vector
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end();
#define sz(x) (int)(x).size()
#define FOR_(i, a, b, s) \
  for (int i = (a); (s) > 0 ? i < (b) : i > (b); i += (s))
#define FOR1(n) FOR_(i, 0, n, 1)
#define FOR2(i, n) FOR_(i, 0, n, 1)
#define FOR3(i, a, b) FOR_(i, a, b, 1)
#define GET5(_1, _2, _3, _4, _5, ...) _5
#define FOR(...) GET5(__VA_ARGS__, FOR_, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define each(x, a) for (auto&& x : a)

constexpr int MX = 200005;
constexpr int INF = 1000000202;
constexpr ll LINF = 1000000000000000202LL;
constexpr ll MOD = 1000000007;  // 998244353;
constexpr ld PI = M_PI;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) { return '"' + s + '"'; }

string to_string(const char* s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) void()
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vt<int> a(n), b(n), c(n);
  FOR(n) { cin >> a[i] >> b[i] >> c[i]; }
  vt<vt<int>> dp(MX, vt<int>(3));
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];
  FOR(n) {
    dp[i + 1][0] =
        max({dp[i + 1][0], dp[i][1] + a[i + 1], dp[i][2] + a[i + 1]});
    dp[i + 1][1] =
        max({dp[i + 1][1], dp[i][2] + b[i + 1], dp[i][0] + b[i + 1]});
    dp[i + 1][2] =
        max({dp[i + 1][2], dp[i][0] + c[i + 1], dp[i][1] + c[i + 1]});
  }
  int ans = 0;
  FOR(3) { ans = max(ans, dp[n - 1][i]); }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 15352