a=list(map(int,input().split())) b=[500,100,50,10,5,1] def dfs(i,cur): if i==6: if cur==a[6]: print('YES') exit(0) else: for j in range(a[i]+1): dfs(i+1,cur+b[i]*j) dfs(0,0) print('NO')