def interest_rates(y, r, t)
  return t == 1 ? 1 + y * r / 100.0 : (1 + r / 100.0) ** y
end

until (n = gets.to_i).zero?
  y, arr, tmp1, ans = gets.to_i, [], 0, nil
  
  n.times do
    b, r, t = gets.split.map(&:to_i)
    tmp2 = interest_rates(y, r, t)
    ans, tmp1 = b, tmp2 if tmp1 < tmp2
  end
  
  puts ans
end