#34882: c++ AC (2ms, 360KB)


yp11151208@yphs.tp.edu.tw (910-42葉宏湧)


#include<bits/stdc++.h>
using namespace std;
main(){
    ios_base::sync_with_stdio(false);
    int n,m,max,maxn,a,b,i;
    while(cin>>n>>m){
        max=0,m/=1000;
        for(i=1;i<=n;i++){
            cin>>a>>b;
            if(b<30) a+=10*m;
            else if(b<40) a+=50*m;
            else a+=100*m;
            if(a>max) max=a,maxn=i;
        }
        cout<<maxn<<' '<<max<<endl;
    }
}