#include #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define bit(n) (1LL<<(n)) #define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ); templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b P; int main(){ int a, b, c, d, e, f, g; cin >> a >> b >> c >> d >> e >> f >> g; rep(i, a+1){ rep(j, b+1){ rep(k, c+1){ rep(l, d+1){ rep(m, e+1){ rep(n, f+1){ if(500*i + 100*b + 50*c + 10*d + 5*e + f == g){ cout << "YES" << endl; return 0; } } } } } } } cout << "NO" << endl; }