/*    ∫ ∫ ∫    ノヽ   (_  )  (_    ) (______ )  ヽ(´・ω・)ノ     |  /    UU */ #pragma region macro #include typedef long long int64; using namespace std; using P = pair; typedef vector vi; const int MOD = (int)1e9 + 7; const int64 INF = 1LL << 62; const int inf = 1<<30; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b ostream& operator<<(ostream& os, const vector &V){ int N = V.size(); REP(i,N){ os << V[i]; if (i!=N-1) os << " "; } os << "\n"; return os; } template ostream& operator<<(ostream& os, pair const&P){ os << "("; os << P.first; os << " , "; os << P.second; os << ")"; return os; } template ostream& operator<<(ostream& os, set &S){ auto it=S.begin(); while(it!=S.end()){ os << *it; os << " "; it++; } os << "\n"; return os; } template ostream& operator<<(ostream& os, deque &q){ for(auto it=q.begin();it> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)}; #pragma endregion //fixed<> N >> X >> Y >> Z; vector A(N); REP(i,N) cin >> A[i]; sort(ALL(A)); int pay; for(auto a:A){ // cerr << X << " " << Y << " "<< Z << bn; if(a>=10000 && Z){ pay = min(a/10000,Z); Z-=pay; a-=10000*pay; if(a<0) continue; } if(a>=5000 && Y){ pay = min(a/5000,Y); Y-=pay; a-=5000*pay; if(a<0) continue; } if(a>= X*1000){ if(a>=X*1000+Y*5000+Z*10000){ cout << "No" << bn; return 0; } if(Y){ Y-=1; a-=5000; continue; }else{ Z-=1; a-=10000; continue; } } X-=(a+1000-1)/1000; } cout << "Yes" << bn; }