A,B,C,D,E,F,G = map(int,input().split()) l = [[A,500],[B,100],[C,50],[D,10],[E,5],[F,1]] for k,v in l: if v <= G: gv = G%v if gv == 0: gv = 9 G -= min(k,gv)*v if G == 0: print("YES") else: print("NO")