import itertools COINS = (500, 100, 50, 10, 5, 1) def solve(a, b, c, d, e, f, g): max_nums = (a, b, c, d, e, f) num_combis = itertools.product(*(range(max_num + 1) for max_num in max_nums)) for num_combi in num_combis: tot = sum(n * k for n, k in zip(num_combi, COINS)) if tot == g: return True else: return False def main(): a, b, c, d, e, f, g = (int(z) for z in input().split()) res = solve(a, b, c, d, e, f, g) print("YES" if res else "NO") if __name__ == "__main__": main()