#include using namespace std; int main(){ int n,g,d,e,p; int m=0; int t=30000*100; cin>>n; for(int i=0; i>g>>d; if(d>0){ e=g-d*30000; } else { e=g; } if(e>m){ m=e; p=i+1; } } t-=m*6; if(t>0){ cout<<"NO"<