a,b,c,d,e,f,G=map(int,input().split()) n=[a,b,c,d,e,f] ns=[500,100,50,10,5,1] for i in range(len(n)): cnt=0 while n[i]-cnt > 0: cnt+=1 if G-ns[i] >= 0: G-=ns[i] else: break if G==0: print('YES') else: print('NO')