#include<iostream>
#include<vector>
#include<string>
#include<map>
using namespace std;

int main() 
{
	while (1) {
		int a;
		cin >> a;
		if (a == 0)break;
		map<double, int>s;
		int c;
		cin >> c;
		for (int b = 0; b < a; b++) 
		{
			double k = 100;
			int d, e, f;
			cin >> d >> e >> f;
			if (f == 1) {
				k += c*e;
			}
			else {
				for (int h = 0; h < c; h++) {
					k += k*e / 100;
				}
			}
			s.insert(pair<double, int>(k / 100, d));
		}
		auto y = s.end();
		y--;
		cout << y->second << endl;
	}
}