def arr_max(arr)
    max = arr[0]
    arr.each do |a|
        if max < a
            max = a
        end
    end
    max
end

N = gets.to_i
A = Array.new(N , Array.new(3))
N.times do |i|
    A[i] = gets.split.map{|n| n.to_i}
end

dp = Array.new(N + 1).map{Array.new(3)}
dp[0] = [0 , 0 , 0]

N.times do |i|

    dp[i + 1][0] = A[i][0] + ((dp[i][1] > dp[i][2]) ? dp[i][1] : dp[i][2])
    dp[i + 1][1] = A[i][1] + ((dp[i][0] > dp[i][2]) ? dp[i][0] : dp[i][2])
    dp[i + 1][2] = A[i][2] + ((dp[i][0] > dp[i][1]) ? dp[i][0] : dp[i][1])
    
end

puts arr_max(dp[N])