#include <bits/stdc++.h>
using namespace std;
int a[100009],b[100009],c[100009];
int main() {
    int n,k;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    for(int i=2;i<=n;i++){
        a[i]+=max(b[i-1], c[i-1]);
        b[i]+=max(a[i-1], c[i-1]);
        c[i]+=max(b[i-1], a[i-1]);
    }
    cout<<max(a[n], max(b[n], c[n]))<<endl;
}
