#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef uint64_t ull; typedef pair P; typedef pair Pid; typedef pair Pdi; typedef pair Pl; typedef pair Pll; typedef pair> PP; typedef pair PPi; constexpr double PI = 3.1415926535897932; // acos(-1) constexpr double EPS = 1e-9; constexpr int INF = 1001001001; constexpr int mod = 1000000007; // constexpr int mod = 998244353; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) #define chadd(x, y) x = (x + y) % mod int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; int x, y, z; cin >> n >> x >> y >> z; vector a(n); for(int i = 0; i < n; ++i) cin >> a[i]; sort(a.begin(), a.end(), greater()); for(int i = 0; i < n; ++i){ int need = a[i] / 10000; if(need < z){ a[i] -= need * 10000; z -= need; } else{ a[i] -= z * 10000; z = 0; } need = a[i] / 5000; if(need < y){ a[i] -= need * 5000; y -= need; } else{ a[i] -= y * 5000; y = 0; } need = a[i] / 1000; if(need < x){ a[i] -= need * 1000; x -= need; } else{ a[i] -= x * 1000; x = 0; } if(a[i] == 0){ if(x > 0){ --x; continue; } if(y > 0){ --y; continue; } if(z > 0){ --z; continue; } } else{ need = ceil((double)a[i] / 1000); if(need <= x){ x -= need; continue; } need = ceil((double)a[i] / 5000); if(need <= y){ y -= need; continue; } need = ceil((double)a[i] / 10000); if(need <= z){ z -= need; continue; } } cout << "No\n"; return 0; } cout << "Yes\n"; }