#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int a, b, c, d, e, f, g; cin >> a >> b >> c >> d >> e >> f >> g; for (int aa = 0; aa <= a; ++aa) { for (int bb = 0; bb <= b; ++bb) { for (int cc = 0; cc <= c; ++cc) { for (int dd = 0; dd <= d; ++dd) { for (int ee = 0; ee <= e; ++ee) { for (int ff = 0; ff <= f; ++ff) { if (aa * 500 + bb * 100 + cc * 50 + dd * 10 + ee * 5 + ff == g) { cout << "YES" << endl; return 0; } } } } } } } cout << "NO" << endl; return 0; }