while true
    n = gets.to_i
    break if n == 0
    y = gets.to_i
    max = [0.0, 0]
    n.times{
        b, r, t = gets.chomp.split.map(&:to_i)
        x = 0
        case t
        when 1 then x = 1 + (r / 100.0) * y
        when 2 then x = (1 + r / 100.0) ** y
        end
        max = [x, b] if max[0] < x
    }
    puts max[1]
end
