#include <iostream>
#include <cmath>
using namespace std;
 
int main() {
    int n;
    const int principal = 10000;
 
    while (cin >> n, n) {
        int y, b, r, t, p, maxp, bid;
        cin >> y;
        maxp = 0;
        while (n--) {
            cin >> b >> r >> t;
            if (t == 1) {
                p = principal * (100 + y * r) / 100;
            }
            else {
                p = principal * pow(1 + (double)r / 100, y);
            }
            if (maxp < p) {
                maxp = p;
                bid = b;
            }
        }
        cout << bid << endl;
    }
    return 0;
}