#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c> a >> b >> c >> d >> e >> f; ll g;std::cin >> g; re(i, a+1){ re(j, b+1){ re(k, c+1){ re(x, d+1){ re(y, e+1){ re(z, e+1){ ll tmp = i*500+j*100+k*50+x*10+y*5+z; if(tmp==g){ std::cout << "YES" << '\n'; return 0; } } } } } } } std::cout << "NO" << '\n'; return 0; }