n = gets.to_i

act = Array.new(n)
for i in 0..n - 1
    act[i] = gets.chomp.split(" ").map(&:to_i)
end

happiness = Array.new(n).map{Array.new(3, 0)}
happiness[0] = [act[0][0], act[0][1], act[0][2]]

for i in 1..n - 1
    # day2~
    for j in 0..2
        # find the maximum value for a, b, c today
        max = 0
        for k in 0..2
            # find the maximum until yersterday
            if (k != j) && (max < happiness[i - 1][k])
                max = happiness[i - 1][k]
            end
        end
        happiness[i][j] = max + act[i][j]
    end
end

puts happiness[n - 1].sort[2]