#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
int n;
int a[maxn][3];
int dp[maxn][3];
int rec(int at, int prev_activity) {
    if(at >= n) {
        return 0;
    }
    if(dp[at][prev_activity] != -1) {
        return dp[at][prev_activity];
    }
    
    int res = 0;
    
    for(int i = 0; i < 3; i++) {
        if(i != prev_activity) {
            res = max(res, rec(at + 1, i) + a[at][i]);
        }
    }
    
    dp[at][prev_activity] = res;
    return res;
}
int main() {
    memset(dp, -1, sizeof dp);
    
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    
    int res = 0;
    for(int i = 0; i < 3; i++) {
        res = max(res, rec(1, i) + a[0][i]);
    }
    
    cout << res << endl;
    
    
    return 0;
}
