def func(coins): G = coins.pop(-1) li = [500,100,50,10,5,1] for i,j in zip(coins,li): while i > 0 and G//j >0: i -= 1 G -= j if G == 0:return ("YES") else:return ("NO") l = list(map(int,input().split())) print(func(l))