Scanf.scanf "%d %d %d %d %d %d %d" (fun a b c d e f g -> let g = g - 500 * min (g / 500) a in let g = g - 100 * min (g / 100) b in let g = g - 50 * min (g / 50) c in let g = g - 10 * min (g / 10) d in let g = g - 5 * min (g / 5) e in let g = g - 1 * min (g / 1) f in print_endline @@ if g = 0 then "YES" else "NO" )