#include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int i = 0; i < n; ++i) #define rep1(i,n) for(int i = 1; i <= n; ++i) using namespace std; templatebool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; } templatebool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; } template inline int sz(T &a) { return a.size(); } using ll = long long; using ld = long double; using pi = pair; using pl = pair; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; const int inf = numeric_limits::max(); const ll infll = numeric_limits::max(); int main() { int n; cin >> n; ll x,y,z; cin >> x >> y >> z; vl a(n); rep(i,n) cin >> a[i]; rep(i,n) { a[i] = (a[i] / 1000 + 1) * 1000; } vector p(n); rep(i,n) { p[i] = {(a[i] % 5000) / 1000 , a[i]}; } sort(p.begin(), p.end()); int id = 0; while(id < n && x - p[id].first >= 0) { x -= p[id].first; p[id].second -= p[id].first * 1000; id++; } if(x > 0) y += x / 5; while(id < n) { if(p[id].first != 0) p[id].second = (p[id].second / 5000 + 1) * 5000; id++; } rep(i,n) { p[i] = {(p[i].second % 10000) / 5000, p[i].second}; } id = 0; while(id < n && y - p[id].first >= 0) { y -= p[id].first; p[id].second -= p[id].first * 5000; id++; } if(y > 0) z += y / 2; while(id < n) { if(p[id].first != 0) p[id].second += 5000; id++; } rep(i,n) { p[i] = {p[i].second / 10000, 0}; } id = 0; while(id < n && z - p[id].first >= 0) { z -= p[id].first; id++; } if(id == n) cout << "Yes" << "\n"; else cout << "No" << "\n"; return 0; }