#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i, m, n) for(int i=int(m);i inline void chmin(T1 &a, T2 b) { if (a > b) a = b; } template inline void chmax(T1 &a, T2 b) { if (a < b) a = b; } typedef long long int ll; using ll = long long int; using ull = long long unsigned int; using Int = long long int; using uInt = long long unsigned int; using Double = long double; using namespace std; #define INF (1 << 30) - 1 #define INFl (ll)5e15 #define DEBUG 0 #define dump(x) cerr << #x << " = " << (x) << endl #define MOD 1000000007 //edit class Solve { public: void solve() { Int N, X, Y, Z; cin >> N >> X >> Y >> Z; vector A(N); for (int i = 0; i < N; ++i) { cin >> A[i]; } auto kiri = [&A](Int base) { for (int i = 0; i < A.size(); ++i) { if (base == 1000 && A[i] % base == 0) { A[i] += 1000; } else { A[i] = (A[i] + base - 1) / base * base; } } }; kiri(1000); auto cmp = [](Int l, Int r, Int base) { l %= base; r %= base; return l < r; }; sort(all(A), [cmp](Int l, Int r) { // l %= 1000; // r %= 1000; // return l < r; return cmp(l, r, 5000); }); for (int i = 0; i < A.size(); ++i) { Int dec = min((A[i] % 5000) / 1000, X); X -= dec; A[i] -= dec * 1000; } Y += X / 5; X = 0; kiri(5000); sort(all(A), [cmp](Int l, Int r) { // l %= 5000; // r %= 5000; // return l < r; return cmp(l, r, 10000); }); for (int i = 0; i < A.size(); ++i) { Int dec = min((A[i] % 10000) / 5000, Y); Y -= dec; A[i] -= dec * 5000; } Z += Y / 2; Y = 0; kiri(10000); for (int i = 0; i < A.size(); ++i) { Int dec = A[i] / 10000; Z -= dec; } if (Z >= 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } } }; int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); Solve().solve(); return 0; }