#include #include #include #include using namespace std; typedef long long ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; ll x,y,z; cin >> x >> y >> z; vector a(n); bool ok=1; for(int i=0;i> a[i]; if(a[i]>=10000){ ll p=min(z,(ll)a[i]/10000); z-=p; a[i]-=10000*p; } if(0<=a[i]&&a[i]<1000&&x>0){ x--; a[i]-=1000; } } sort(a.rbegin(),a.rend()); if(z>0){ for(int i=0;i=0&&z>0){ a[i]-=10000; z--; }else{ break; } } for(int i=0;i=5000){ ll p=min(y,(ll)a[i]/5000); y-=p; a[i]-=5000*p; } if(0<=a[i]&&a[i]<1000&&x>0){ x--; a[i]-=1000; } } }else{ for(int i=0;i=5000){ ll p=min(y,(ll)a[i]/5000); y-=p; a[i]-=5000*p; } if(0<=a[i]&&a[i]<1000&&x>0){ x--; a[i]-=1000; } } } sort(a.rbegin(),a.rend()); if(y>0){ for(int i=0;i=0&&y>0){ a[i]-=5000; y--; }else{ break; } } for(int i=0;i=0)ok=0; } if(ok){ printf("Yes\n"); }else{ printf("No\n"); } }