C = list(map(int, input().split())) V = [500, 100, 50, 10, 5, 1] for i in range(6): C[6] -= V[i] * min(C[6]//V[i], C[i]) print('YES' if C[6] == 0 else 'NO')