# coding: utf-8

# Your code here!



N = int(eval(input()))

S = int(eval(input()))



if N%500<=S:

    print("Yes")

else:

    print("No")
# coding: utf-8

# Your code here!

N = int(eval(input()))

A = int(eval(input()))



if N%500 <= A:

    print("Yes")

else: 

    print("No")

# coding: utf-8
# Your code here!
N = int(eval(input()))
S = int(eval(input()))
if N % 500 <= S:
    print("Yes")
else:
    print("No")

# coding: utf-8
# Your code here!
N = int(eval(input()))
A = int(eval(input()))
if N % 500 <= A:
    print("Yes")
else:
    print("No")

-S = int(eval(input())) -if N % 500 <= S: +A = int(eval(input())) +if N % 500 <= A: