A, B, C, D, E, F, G = map(int, input().split()) coins = [ (500, A), (100, B), (50, C), (10, D), (5, E), (1, F) ] current = {0} for value, count in coins: temp = set() for s in current: max_i = min(count, (G - s) // value) for i in range(max_i + 1): new_sum = s + value * i temp.add(new_sum) current = temp if not current: break print("YES" if G in current else "NO")