#include #include using namespace std; int main(int argc, char* argv[]) { int N; cin>>N; vector G(N),D(N); int i; for (i=0;i>G[i]>>D[i]; } int n; int exp=0; i=0; for (n=1;n<=6;n++){ exp+=G[i]-30000*D[i]; i++; i%=N; } if (exp>=30000){ cout<<"YES"<N){ i=1; } } }else{ cout<<"NO"<