#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,A=0,B=0,C=0,a,b,c; cin >> n;
  for (int i=0; i<n; i++) {
    cin >> a >> b >> c;
    a+=max(B,C); b+=max(A, C); c+= max(A,B);
    A=a; B=b; C=c;
  }
  cout << max(A, max(B,C)) << endl;
}


