a, b, c, d, e, f, g = map(int, input().split()) money = [500, 100, 50, 10, 5, 1] for num, m in zip([a, b, c, d, e, f], money): tmp = min(g // m, num) g -= tmp * m if g == 0: print("YES") else: print("NO")