#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <ctype.h>
#include <vector>
#include <regex>
#include <locale>
#include <stack>
#include <queue>
#include <bitset>
#include <map>
#include <iterator>
#include <set>
#include <climits>
#include <memory>
#include <unordered_map>
#include <unordered_set>
#define FASTIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define INF 1e9 + 5
#define MOD 1000000007

using namespace std;

void leftrotate(string &s, int d) {
    reverse(s.begin(), s.begin()+d);
    reverse(s.begin()+d, s.end());
    reverse(s.begin(), s.end());
}

void rightrotate(string &s, int d) {
    leftrotate(s, s.length()-d);
}

std::string ltrim(const std::string& s) {
	return std::regex_replace(s, std::regex("^\\s+"), std::string(""));
}

std::string rtrim(const std::string& s) {
	return std::regex_replace(s, std::regex("\\s+$"), std::string(""));
}

std::string trim(const std::string& s) {
	return ltrim(rtrim(s));
}

void helper (ll A, string& result) {
	if (A > 1)
        helper (A / 2, result);
    result += to_string (A % 2);
}

string dec_to_bin (ll A) {
    string result;
    helper (A, result);
    return result;
}

void print_intmatrix_vector (vector<vector<int>> &mat) {
    for_each (mat.begin (), mat.end (), [](auto x) {for_each (x.begin (), x.end (), [](int x){cout << x << ' ';});cout << '\n';});
    cout << '\n';
}

void print_int_vector (vector<int> &vec) {
    for_each (vec.begin (), vec.end (), [](int x){cout << x << ' ';});
    cout << '\n';
}

void replace (string &s, const char search, const char key) {
    replace(s.begin(), s.end(), search, key);
}

void int_vector_to_string (vector<int>& vec, string& ans, int start = 0, int end = 0) {
    for_each (vec.begin () + start, vec.end () - end, [&ans](int x){ans += to_string (x);});
}

string multiply (string a, string b) {
    int a_len = a.size (), b_len = b.size ();
    vector<int> vals((a_len + b_len + 1), 0);
    for (int i = b_len - 1; i >= 0; --i) {
        for (int j = a_len - 1; j >= 0; --j) {
            int num1 = b[i] - '0', num2 = a[j] - '0';
            int mul = num1 * num2;
            if (mul > 9) {
                vals[i + j + 1] += mul % 10;
                vals[i + j ] += mul / 10;
            } else {
                vals[i + j + 1] += mul;
            }
            if (vals[i + j + 1] > 9) {
                mul = vals[i + j + 1];
                vals[i + j + 1] = mul % 10;
                vals[i + j] += mul / 10;
            }
        }
    }
    int i = 0;
    while (vals[i] == 0) {
        i++;
    }
    string ans = "";
    int_vector_to_string (vals, ans, i, 1);
    return ans;
}

int get_first_negative (vector<int>& vt) {
    int low = 0, high = vt.size () - 1;
    while (low <= high) {
        int mid = (low + high) / 2;
        if (vt[mid] < 0 && vt[max (mid - 1, 0)] >= 0) {
            return mid;
        } else if (vt[mid] >= 0) {
            low = mid + 1;
        } else if (vt[max (mid - 1, 0)] < 0) {
            high = mid - 1;
        }
    }
    return -1;
}

int get_first_zero (vector<int>& vt) {
    int low = 0, high = vt.size () - 1;
    while (low <= high) {
        int mid = (low + high) / 2;
        if (vt[mid] == 0 && vt[max (mid - 1, 0)]  == 1) {
            return mid;
        } else if (vt[mid] == 1) {
            low = mid + 1;
        } else if (vt[mid] == 0) {
            high = mid - 1;
        }
    }
    return -1;
}

int main () {
  FASTIO
  int n;
  cin >> n;
  vector<int> dp(3, 0);
  for (int i = 0; i < n; ++i) {
    vector<int> c(3);
    vector<int> new_dp(3, 0);
    for (int i = 0; i < 3; ++i) {
      cin >> c[i];
    }
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        if (i != j) {
          new_dp[j] = max (new_dp[j],dp[i] + c[j]);
        }
      }
    }
    dp = new_dp;
  }
  cout << *max_element (dp.begin (), dp.end ()) << '\n';
  return 0;
}




Measured memory_bytes: 256