import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 10^^9 + 7;

void main() {
    int n;
    scan(n);
    auto a = new int[](n);
    auto b = new int[](n);
    auto c = new int[](n);
    iota(n).each!(i => scan(a[i], b[i], c[i]));
    
    auto dp = new int[][](n + 1, 4);
    fillAll(dp, -inf);
    dp[0][0] = 0;

    foreach (i ; 0 .. n) {
        foreach (j ; 0 .. 4) {
            if (j != 1) {
                dp[i+1][1] = max(dp[i+1][1], dp[i][j] + a[i]);
            }
            if (j != 2) {
                dp[i+1][2] = max(dp[i+1][2], dp[i][j] + b[i]);
            }
            if (j != 3) {
                dp[i+1][3] = max(dp[i+1][3], dp[i][j] + c[i]);
            }
        }
    }

    auto ans = max(dp[n][1], dp[n][2], dp[n][3]);

    writeln(ans);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}