#include #include using namespace std; int main(){ int a,b,c,d,e,f,g; cin>>a>>b>>c>>d>>e>>f>>g; g=g-500*min(a,g/500); g=g-100*min(b,g/100); g=g-50*min(c,g/50); g=g-10*min(d,g/10); g=g-5*min(e,g/5); g=g-min(f,g); if(g==0){ cout << "YES" << endl; }else{ cout << "NO" << endl; } }