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