import std.stdio, std.math, std.algorithm, std.array, std.string, std.conv, std.container, std.range;
T Read(T)() { return readln.chomp.to!(T); }
T[] Reads(T)() { return readln.split.to!(T[]); }
alias read = Read!(int);
alias reads = Reads!(int);

int n;
int[] a;
int[] b;
int[] c;

long[][] dp = new long[][](100010, 4);
long rec(int i, int p) {
    if (dp[i][p] >= 0)
        return dp[i][p];
    if (i == n)
        return dp[i][p] = 0;
    long ret;
    int[] lucky = [a[i], b[i], c[i]];
    foreach (c; 0..3) if (c != p) {
        ret = max(ret,
                rec(i+1, c) + lucky[c]);
    }
    return dp[i][p] = ret;
}

void main() {
    n = read();
    a.length = b.length = c.length = n;
    foreach (i; 0..n) {
        readf("%d %d %d\n", &a[i],&b[i],&c[i]);
    }
    foreach (r; dp) fill(r, -1);
    writeln(rec(0, 3));
}
