#include #define rep(i, n) for(int i=0; i<(n); ++i) #define rep2(i, s, n) for(int i=s; i<(n); ++i) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; template using priority_queue_rev = priority_queue, greater >; static const int INTINF = (2147483647 >> 1); // 10^9 + 5000 static const ll LLINF = (9223372036854775807 >> 1); static const int MAX = 1e5+1; static const ll MOD = 1e9+7; namespace Kunitaka{ template< typename TYPE, std::size_t SIZE > std::size_t array_length(const TYPE (&array)[SIZE]) { return SIZE; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } } using namespace Kunitaka; namespace Printer{ void br(){ cout << endl; } void loop_cnt(int i){ cout << "i = " << i << endl; } void loop_cnt(int i, int j){ cout << "i = " << i << ", " << "j = " << j << endl; } template void print(T x){ cout << x << endl; } template void print(T x, S y){ cout << x << "," << y << endl; } template void print(T x, S y, U z){ cout << x << "," << y << "," << z << endl; } template void print(pair p){ cout << p.first << ", " << p.second << endl; } template< typename TYPE, std::size_t SIZE > void print(const TYPE (&array)[SIZE]){ int lim = array_length(array); for(int i=0; i void print(vector v){ for(int i=0; i void print(vector > vv){ for(int i=0; i> N >> X >> Y >> Z; ll vals[3] = {Z, Y, X}; ll en[3] = {10000, 5000, 1000}; vector A(N); rep(i, N) cin >> A[i]; rep(j, 3){ sort(ALL(A), greater()); rep(i, N){ if(A[i] < 0) continue; while(vals[j] > 0 && A[i] >= en[j]) { A[i] -= en[j]; vals[j]--; } } sort(ALL(A), greater()); rep(i, min(N, vals[j])){ A[i] -= en[j]; } } bool ok = true; rep(i, N){ // print(A[i]); if(A[i] >= 0) ok = false; } yesno(ok); return 0; }