#include #include #include using namespace std; int main() { int n, X, Y, Z; cin >> n >> X >> Y >> Z; vector la(n); for (int i = 0; i < n; ++i) { cin >> la[i]; } sort(la.begin(), la.end(), greater()); for (int a: la) { int z = min(a/10000+1, Z); a -= z*10000; Z -= z; if (a < 0) continue; int y = min(a/5000+1,Y); a -= y*5000; Y -= y; if (a < 0) continue; int x = min(a/1000+1,X); a -= x*5000; X -= x; if (a < 0) continue; cout << "No" << endl; return 0; } cout << "Yes" << endl; }