#54063: C++


austin.cy.yang@gmail.com (Austin)


#include <iostream>
using namespace std;

int main () {
    int n,S,best_num,best_CP=0;
    cin >>n >>S;
    for (int i=1; i<=n; i++) {
        int CP,IV;
        cin >>CP >>IV;
        if (IV>=0&&IV<=29) {
            CP+=(S/1000)*10;
        }
        else if (IV>=30&&IV<=39) {
            CP+=(S/1000)*50;
        }
        else if (IV>=40&&IV<=45) {
            CP+=(S/1000)*100;
        }
        if (CP>best_CP) {
            best_CP=CP;
            best_num=i;
        }
    }
    cout <<best_num <<' ' <<best_CP;
}