ag=list(map(int,input().split())) c=[500,100,50,10,5,1] af=ag[:6] g=ag[-1] for ck,ak in zip(c,af): m=min(g//ck,ak) g-=ck*m if g: print("NO") else: print("YES")