#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { array cs; int32_t g; for (auto i = 0; i < 6; ++i) { cin >> cs[i]; } cin >> g; array xs = {500, 100, 50, 10, 5, 1}; for (auto i = 0; i < 6; ++i) { g -= min(cs[i], g / xs[i]) * xs[i]; if (g == 0) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }