#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef pair pii; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i) #define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i) #define DEBUG(x) cout<<#x<<": "<>n>>x>>y>>z; vi a(n); REP(i,n) { cin>>a[i]; } REP(i,n){ //DEBUG(x); //DEBUG(y); //DEBUG(z); int xx,yy,zz; int usex=0, usey=0; //DEBUG(a[i]); if(z > 0){ zz = min(z,(a[i]/10000)); a[i] -= zz*10000; z -= zz; } if(y > 0){ yy = min(y,(a[i]/5000)); a[i] -= yy*5000; y -= yy; usey += yy; } if(x > 0){ xx = min(x,(a[i]/1000)); if(xx*1000 > a[i]){ a[i] -= xx*1000; x -= xx; usex += xx; } } if(a[i]>=0){ if(a[i]>=0 && x>0){ xx = min(x,(a[i]/1000)+1); a[i] -= xx*1000; x -= xx; usex += xx; } if(y>0){ yy = min(y,(a[i]/5000)+1); a[i] -= yy*5000; y -= yy; usey += yy; } if(a[i]>=0 && z>0){ zz = min(z,(a[i]/10000)+1); a[i] -= zz*10000; z -= zz; } if(usey > 0 && ((a[i]/-5000) > 0)){ yy = min(usey,(a[i]/-5000)); if(a[i] == -yy*5000) yy--; a[i] += yy*5000; y += yy; } if(usex > 0 && ((a[i]/-1000) > 0)){ xx = min(usex,(a[i]/-1000)); if(a[i] == -xx*1000) xx--; a[i] += xx*1000; x += xx; } } if(a[i]>=0 && x>0){ xx = min(x,(a[i]/1000)+1); a[i] -= xx*1000; x -= xx; } //a[i]==0は釣りがないのでだめ if(a[i]>=0){ cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }