#include #include #include #include #include #include #include #include #include #include using namespace std; struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<ostream &operator<<(ostream &o,const vector&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<> n >> x >> y >> z; vector a(n); for (int i=0; i> a[i]; sort(a.rbegin(), a.rend()); for (int i=0; i= 5000) { int _z = min(z, a[i]/10000); a[i] -= 10000 * _z; z -= _z; } } sort(a.rbegin(), a.rend()); for (int i=0; i= 1000) { int _y = min(y, a[i]/5000+1); a[i] -= 5000 * _y; y -= _y; } } sort(a.rbegin(), a.rend()); for (int i=0; i= 0) { int _x = min(x, a[i]/1000+1); a[i] -= 1000 * _x; x -= _x; } } auto cmp = [](int x){return x<0;}; bool ans = all_of(a.begin(), a.end(), cmp); cout << (ans? "Yes" : "No") << endl; }