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