yens = input().split(" ") price = [500, 100, 50, 10, 5, 1] for i in range(len(yens)): yens[i] = int(yens[i]) task = yens[6] for i in range(len(yens)-1): while True: if task < price[i] or yens[i] == 0: break task -= price[i] yens[i] -= 1 if task == 0: print("YES") else: print("NO")