E869120 has A 1-yen coins and infinitely many 500-yen coins.   Determine if he can pay exactly N yen using only these coins.
N = int(input())
A = int(input())

remain = N - A
if remain%500 == 0:
  print("Yes")
else:
  print("No")
N = int(input())
A = int(input())
 
remain = N%500
if remain <= A:
  print("Yes")
else:
  print("No")