es=gets.split(" ").map{|e| e.to_i} g=es.pop es.zip([500,100,50,10,5,1]).each{|c,m| t=[g/m,c].min g-=t*m } puts (g==0)?("YES"):("NO")