#include using namespace std; int main(){ const int P[6]={500,100,50,10,5,1}; int coin[6],G; for(int i=0;i<6;i++)cin >> coin[i]; cin >> G; for(int i=0;i<6;i++){ while(G>=P[i] && coin[i]-->0)G-=P[i]; } if(G==0)cout << "YES" << endl; else cout << "NO" << endl; return 0; }