#include using namespace std; int main(int argc, char* argv[]) { int A,B,C,D,E,F,G; cin>>A>>B>>C>>D>>E>>F>>G; while (G>=500){ if (A>0){ G-=500; A--; }else{ break; } } while (G>=100){ if (B>0){ G-=100; B--; }else{ break; } } while (G>=50){ if (C>0){ G-=50; C--; }else{ break; } } while (G>=10){ if (D>0){ G-=10; D--; }else{ break; } } while (G>=5){ if (E>0){ G-=5; E--; }else{ break; } } while (G>=1){ if (F>0){ G-=1; F--; }else{ break; } } if (G==0){ cout<<"YES"<