n = gets.to_i
dp = Array.new(n+1).map{Array.new(3,0)}
n.times do |x|
    a = gets.split.map(&:to_i)
    3.times do |i|
        3.times do |j|
            next if i == j
            dp[x+1][i] = dp[x][j]+a[i] if dp[x+1][i] < dp[x][j]+a[i]
        end
    end
end
puts dp[n].max