a,b,c,d,e,f,g = map(int, input().split()) s=500*a+100*b+50*c+10*d+5*e+f x=1 if g==s: x=0 while g=500 and a>0: s-=500; a-=1 elif y>=100 and b>0: s-=100; b-=1 elif y>=50 and c>0: s-=50; c-=1 elif y>=10 and d>0: s-=10; d-=1 elif y>=5 and e>0: s-=5; e-=1 elif y>=1 and f>0: s-=1; f-=1 else: break if g==s: x=0; break print(["YES","NO"][x])