#include using namespace std; #define rep(i,n) for(int i=0; i P; int main(){ ll N,M; //string S; cin >> N; vector A(N); ll X,Y,Z; cin >> X>>Y>>Z; rep(i,N){ cin >> A[i]; } rep(i,N){ if(A[i] < 1000 && X>0){ X--; continue; }else if(A[i] < 5000 && Y > 0){ Y--; continue; }else if(A[i] < 10000 && Z > 0){ Z--; continue; } while(A[i] >= 10000 && Z>0){ A[i] -= 10000; Z--; } while(A[i] >= 5000 && Y>0){ A[i] -= 5000; Y--; } while(A[i] >= 1000 && X>0){ A[i] -= 1000; X--; } if(A[i] >= 1000){ cout << "No" <= 0){ if(X > 0){ X--; }else if(Y > 0){ Y--; }else if(Z > 0){ Z--; }else{ cout << "No" <