/** ,~(.xvzzzzw-?w. `, ... ...~~~(++z+. zzzzzzzzzzzwv1w} (\ .,...iOvzzzzzzzzn ...?zVXQkmQQmwwwzzzzzXdVTDHkHKlkdS=-.._``````.```````.0wzv+jHpHRc-=` .< ` 7XwZ4wppHHkXzZ/._`````..<<<-`````.JGJ1?4JWWHX. ` ~--~~(7WdpfWyWTZ(h `````..<;;;+>`...HyjAXVVHXyWpv- ` ?3(JppWWVWnJ77Ti.````` _````..HVWHyWpWHjVyWWWA . ` ` dppVHyp^ J(JNkWHXaJ....?>~HWVWWHpppH(WXWHVWn.` ` (ppfWHWK4WVVWkWkWVV@~~~~~~~JWHbpqpppH(.( }.! j- .??~,? . .g!?=>:.<(HpppHWWHKT$~~:~~:~_TT9WVkppH/J?c! jiH[ ` ` x _i. .Hb.,`_.(.HpppWXWk~?<(/__(+?!~._uI?"^.J`,. ,_4VP-. ( .,! ..pWW?-`./1JvWKYTY^~.~J=::(d/~.~.~` .>./`(C~~_8 /` ` ` !_? _(Wy%``.: ~_.!. `_~(W_:::dk~--_ `.j^.2.v<&-(/?_` < ` }WV````.1} .(!!!. dk"71+dky`. !~:~::~::::1 . ....._;+uajJ&JJJJv"! .~` ._(?<::::::::::::?<11-` `` ` .MWXzvd[ ` 4, .~(<>::::+++xIz++<<<<1.z1 ` .dSV7"TXwzzX- ` ?+z<+NZ[`.`.7Sa.-zzzzzzzzi_- ,jzzwSzzzzzZ!``.`.Z=<>zHU-`....XXzzzzzzzzzzzi.; ` ,!JzzzzzzzzzzXz0&..(r _vWn`.dzzzzzzzzzzzzzzzn.i .?.wzzzzzzzzzzzzzzzzzX`` `(.kUzzzzzzzzzzzzzzzzzzzo,- ` **/ #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<=(int)(n);++i) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll a, b, c, d, e, f, g; cin >> a >> b >> c >> d >> e >> f >> g; string s = "NO"; rep(ia,a) { rep(ib,b) { rep(ic,c) { rep(id,d) { rep(ie,e) { rep(i, f) { ll ans = 500 * ia + 100 * ib + 50 * ic + 10 * id + 5 * ie + i; if (ans == g) { s = "YES"; goto output; } } } } } } } output: cout << s << endl; return 0; }