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