E869120 has A 1-yen coins and infinitely many 500-yen coins.   Determine if he can pay exactly N yen using only these coins.
input = [int(input()) for i in range(2)]
print(input)
if input[0] % 500 < input[1]:
   print("Yes")
else:
    print("No")
input = [int(input()) for i in range(2)]
if input[0] % 500 <= input[1]:
   print("Yes")
else:
    print("No")
