#include //ios::sync_with_stdio(false); //cin.tie(0); using namespace std; typedef long long ll; typedef pair pii; typedef pair ppii; typedef pair pipi; typedef pair pll; typedef pair plpl; typedef tuple tl; ll mod=1000000007; ll mod2=998244353; ll inf=1000000000000000000; double pi=2*acos(0); #define rep(i,m,n) for(int i=m;i=m;i--) ll lmax(ll a,ll b){ if(a>a>>b>>c>>d>>e>>f>>g; rep(i,0,a+1){ rep(j,0,b+1){ rep(k,0,c+1){ rep(l,0,d+1){ rep(m,0,e+1){ rep(n,0,f+1){ if(500*a+100*b+50*c+10*d+5*e+f==g){ cout<<"YES"<