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