#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define llint long long #define inf 1e18 #define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++) #define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++) #define chmin(x, y) (x) = min((x), (y)) #define chmax(x, y) (x) = max((x), (y)) using namespace std; typedef pair P; llint n, x, y, z; llint a[100005]; vector vec, vec2, vec3, svec; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> x >> y >> z; for(int i = 1; i <= n; i++) cin >> a[i], a[i] = (a[i]+1000) / 1000; for(int i = 1; i <= n; i++){ llint t = min(z, a[i]/10); z -= t; a[i] -= t * 10; } if(z == 0){ for(int i = 1; i <= n; i++){ llint t = min(y, a[i]/5); y -= t; a[i] -= t * 5; vec.push_back(a[i]); } sort(vec.rbegin(), vec.rend()); for(int i = 0; i < vec.size(); i++){ if(y > 0) y--; else x -= vec[i]; } if(x >= 0) cout << "Yes" << endl; else cout << "No" << endl; return 0; } for(int i = 1; i <= n; i++){ if(a[i] == 0) continue; if(a[i] < 5) vec.push_back(a[i]); else vec2.push_back(a[i]); vec3.push_back(a[i] % 5); } if(z > (int)vec.size()){ cout << "Yes" << endl; return 0; } sort(vec.rbegin(), vec.rend()); sort(vec2.rbegin(), vec2.rend()); sort(vec3.rbegin(), vec3.rend()); svec.push_back(0); for(int i = 0; i < vec3.size(); i++) svec.push_back(svec.back() + vec3[i]); for(int i = 0; i <= min(z, (llint)vec2.size()); i++){ llint len = (int)vec2.size()-i; if(len > y){ llint need = svec.back(); need += (len - y) * 5; if(need <= x){ cout << "Yes" << endl; return 0; } } llint need = svec.back() - svec[y-len]; if(need <= x){ cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }