coins = [500, 100, 50, 10, 5, 1] A, B, C, D, E, F, G = map(int, input().split()) coinamount = [A, B, C, D, E, F] totallist = [0] for i in range(0, 6): N = len(totallist) for j in range(0, N): for k in range(1, coinamount[i]+1): totallist.append(totallist[j]+coins[i]*k) if G in totallist: print('YES') else: print('NO')