import std.stdio;
import std.string;
import std.conv;
import std.array;

void main()
{
    int N = readln.chomp.to!int;
    int[3][] price = new int[3][](N);
    foreach (i; 0..N) price[i] = readln.split.to!(int[]);

    int[3][] max_sum = new int[3][](N);
    max_sum[0] = price[0];

    foreach (i; 1..N){
        foreach (j; 0..3){
            int max_p = 0;
            foreach (k; 0..3){
                if (k == j) continue;
                if (max_sum[i - 1][k] > max_p) max_p = max_sum[i - 1][k];
            }
            max_sum[i][j] = max_p + price[i][j];
        }
    }

    int max = max_sum[$ - 1][0];
    foreach (i; 1..3){
        if (max_sum[$ - 1][i] > max) max = max_sum[$ - 1][i];
    }

    writeln(max);
}

