#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #define rep(i,n) for(int i=0;i<(n);i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) ((int)(x).size()) #define pb push_back using ll = long long; using namespace std; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> A >> B >> C >> D >> E >> F >> G; rep(a,A+1) rep(b,B+1) rep(c,C+1) rep(d,D+1) rep(e,E+1) rep(f,F+1){ if(a*500+b*100+c*50+d*10+e*5+f==G){ cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }