typedef long long ll; #include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n,x,y,z; std::cin >> n>>x>>y>>z; vector a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } priority_queue pq; for (int i = 0; i < n; i++) { pq.push((a[i]+999)/1000); } while(pq.size()&&z>0){ auto now = pq.top();pq.pop(); if(now<=10){ z--; continue; } if(now/10 <= z ){ z -= now/10; now %= 10; }else{ now -= z*10; z = 0; } pq.push(now); } if(pq.size()==0){ std::cout << "Yes" << std::endl; return 0; } while(pq.size()&&y>0){ auto now = pq.top();pq.pop(); if(now<=5){ y--; continue; } if(now/5 <= y ){ y -= now/5; now %= 5; }else{ now -= y*5; y = 0; } pq.push(now); } if(pq.size()==0){ std::cout << "Yes" << std::endl; return 0; } while(pq.size()&&x>0){ auto now = pq.top();pq.pop(); if(x>=now){ x -= now; continue; }else{ std::cout << "No" << std::endl; return 0; } } if(pq.size()==0){ std::cout << "Yes" << std::endl; }else{ std::cout << "No" << std::endl; } }