A = list(map(int, input().split())) g = A.pop() JPY = [500, 100, 50, 10, 5, 1] for a, jpy in zip(A, JPY): for _ in range(a): if g >= jpy: g -= jpy print("YNEOS"[g::2])