import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines *nums, G = map(int,read().split()) coin = [] values = [500, 100, 50, 10, 5, 1] for value, num in zip(values, nums): coin += [value] * num for x in coin: if G >= x: G -= x answer = 'YES' if G == 0 else 'NO' print(answer)