n = gets.to_i
a = n.times.map{gets.split.map(&:to_i)}
dp = Array.new(n+1).map{Array.new(3,0)}
for i in 0..n-1
    for j in 0..2
        for k in 0..2
            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[i][j]
    end
end
p dp[n].max