Problem:
 Score: 100 points    Problem Statement  E869120 has A  1 -yen coins and infinitely many 500 -yen coins. Determine if he can pay exactly N yen using only these coins.      Constraints   N is an integer between 1 and 10000 (inclusive).  A is an integer between 0 and 1000 (inclusive).         Input  Input is given from Standard Input in the following format:  N  A       Output  If E869120 can pay exactly N yen using only his 1 -yen and 500 -yen coins, print Yes ; otherwise, print No .        Sample Input 1 2018
218      Sample Output 1 Yes  We can pay 2018 yen with four 500 -yen coins and 18  1 -yen coins, so the answer is Yes .       Sample Input 2 2763
0      Sample Output 2 No  When we have no 1 -yen coins, we can only pay a multiple of 500 yen using only 500 -yen coins. Since 2763 is not a multiple of 500 , we cannot pay this amount.       Sample Input 3 37
514      Sample Output 3 Yes

Solution (Python):
N=int(input())
A=int(input())
if (N%500)>A:
    print('No')
else:
    print('Yes')

Solution (Python):
n = int(input())
a = int(input())

t = n % 500 - a

if t <= 0:
  print("Yes")
else:
  print("No")

Solution (Python):
n, a = [int(input()) for i in range(2)]
print('Yes') if n%500<=a else print('No')

Solution (Python):
n=int(input())
a=int(input())
print("No" if n%500>a else "Yes")

Solution (Python):
n=int(input())
a=int(input())
if(n%500 <=a):
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):


a =int( input())
b =int( input())

c=a%500

if c<=b:
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
a=int(input())
if n%500-a<=0:
    print("Yes")
else:
    print("No")

Solution (Python):
a = [int(input()) for i in range(2)]
if a[0] % 500 <= a[1]:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())

if N%500 <= 218:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
a = int(input())
if N % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

amari = N % 500

if amari <= A :
    print("Yes")
else:
    print("No")

Solution (Python):


N_yen = int(input())
A_1mai = int(input())

answer = 'Yes' if N_yen % 500 <= A_1mai else 'No'
print(answer)

Solution (Python):
N = int(input())
A = int(input())

X = 0
while X <= N:
	if N - X <= A:
		print("Yes")
		exit()
	X += 500

print("No")

Solution (Python):
N =int(input())
A = int(input())

if N % 500 <= A:
	print('Yes')
else:
	print('No')

Solution (Python):
n=int(input())
x=int(input())
print('Yes' if n%500<=x else'No')

Solution (Python):
N = input()
A = input()

rest = N % 500
if rest <= A:
	print "Yes"
else:
	print "No"

Solution (Python):
N = int(input())
A = int(input())

N %= 500

ans = 'Yes' if A >= N else 'No'

print(ans)

Solution (Python):
N=int(input())
A=int(input())
if N%500<=A:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if a >= n % 500:
    print('Yes')
else:
    print('No')

Solution (Python):
if int(input())%500<=int(input()):
    print("Yes")
else:
    print("No")

Solution (Python):
n, a = [int(input()) for _ in range(2)]
if n % 500 > a:
    print('No')
else:
    print('Yes')

Solution (Python):
N = int(input())
A = int(input())
if A - N % 500 >=0:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
x = n%500
if x <= a:
    print('Yes')
elif x > a:
    print('No')

Solution (Python):
f=lambda:int(input())
n=f();a=f()
print('Yes'if n%500<=a else'No')

Solution (Python):
N = int(input())%500
A = int(input())
 
 
if A >= N:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
n=int(input())
a=int(input())
if n%500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):

N = int(input())
A = int(input())


n = N % 500
if n <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

if n%500 <= a:
	print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())

print("Yes" if A >= (N % 500) else "No")

Solution (Python):


n  = int( input())
a  = int( input())

if (n%500) <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())

print('Yes' if (N%500 <= A) else 'No')

Solution (Python):
N = int(input())
a = int(input())
if a >= N % 500:
  print("Yes")
else:
  print("No")

Solution (Python):
a=int(input())
b=int(input())
if a >= 500:
  c=a//500
  l=a-c*500
  if l <= b:
    print("Yes")
  else:
    print("No")
else:
  if a <= b:
    print("Yes")
  else:
    print("No")

Solution (Python):

N, A = int(input()), int(input())
print(["No","Yes"][N%500<=A])

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=int(input())
if a>=n%500:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

ans = 'No'
for i in range(a+1):
    if (n-i)%500 == 0:
        ans = 'Yes'
        break
print(ans)

Solution (Python):
N,A = [int(input()) for i in range(2)]

Z = N - (N//500 * 500)

if Z > A:
    print("No")
else:
    print("Yes")

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if N % 500 <= A else 'No')

Solution (Python):
N = int(input())
A = int(input())

V = N % 500

if V <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
if n%500 < int(input())+1:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
	print("Yes")
else:
	print("No")

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())
if N%500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

flag = 1

while(flag == 1):
    if n >= 500:
        n -= 500

    else:
        flag = 0

if n <= a:
    print("Yes")

else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
n = (n % 500)
print(["No", "Yes"][n <= a])

Solution (Python):
n = int(input())
a = int(input())
print("Yes" if n % 500 <= a else "No")

Solution (Python):
n = int(input()) % 500
if n > int(input()):
    print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())
a = int(input())
if n%500 > a:
  print("No")
else:
  print("Yes")

Solution (Python):
n = int(input())
m = int(input())

if n%500 <= m:
    print("Yes") 
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
r = n-int(n/500)*500
if r <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())
s=N%500
if s<=A:
  print('Yes')
else:
  print('No')

Solution (Python):
print("YNeos"[int(input())%500>int(input())::2])

Solution (Python):
n, a = [int(input()) for _ in range(2)]
print('No' if max(0, n % 500 - a) else 'Yes')

Solution (Python):
from sys import stdin

N = int(stdin.readline().rstrip())
A = int(stdin.readline().rstrip())

if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
if (N%500) > A:
  print('No')
else:
  print('Yes')

Solution (Python):
N = int(input())
A = int(input())
if (499 <= A):
  print('Yes')
else:
  if (N % 500 <= A):
    print('Yes')
  else:
    print('No')

Solution (Python):
N=int(input())
A=int(input())
if(N%500<=A):
    print('Yes')
else:
    print('No')

Solution (Python):
B=[int(input()) for _ in range(2)]
print(["Yes","No"][B[0]%500>B[1]])

Solution (Python):
N = int(input())
A = int(input())

diff = (N % 500)

if diff <= A:
    ans = "Yes"
else:
    ans = "No"
print(ans)

Solution (Python):
if int(input())%500<=int(input()):print('Yes')
else:print('No')

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

amari = N % 500
if A >= amari:
  print('Yes')
else:
  print('No')

Solution (Python):
a=int(input());b=int(input());print("YNeos"[a%500>b::2])

Solution (Python):
a = int(input())
b = int(input())
if b >= (a % 500):
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())
R=N%500
ans='Yes'
if R>A:
    ans='No'
print(ans)

Solution (Python):
N = int(raw_input())
A = int(raw_input())

if N % 500 <= A: print 'Yes'
else: print 'No'

Solution (Python):
N = int(input())
A = int(input())

N = N % 500
if N <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N = int(input())
A = int(input())
if N%500 <= A:
	print('Yes')
else:
	print('No')

Solution (Python):
n = int(input())
a = int(input())

print('Yes')  if n%500 <= a else print('No')

Solution (Python):
a = int(input())
b = int(input())
if b >= (a % 500):
    print("Yes")
else:
    print("No")

Solution (Python):
print(['Yes','No'][int(input())%500>int(input())])

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())

print(["Yes", "No"][N % 500 > A])

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N,A = [int(input()) for i in range(2)]
if N%500 <=A:
  print("Yes")
else :
  print("No")

Solution (Python):
print(['Yes','No'][int(input())%500>int(input())])

Solution (Python):
print('No'if int(input())%500>int(input())else'Yes')

Solution (Python):
n=int(input())%500
print('No' if n>int(input()) else 'Yes')

Solution (Python):
n=int(input())%500
a=int(input())
print('No' if n>a else 'Yes')

Solution (Python):
N = int(input())
A = int(input())
for a in range(A+1):
    for j in range(21):
        if a + 500 * j == N: 
            print("Yes")
            exit()
print("No")

Solution (Python):
n = int(input())
a = int(input())
five = 500
if (n % five <= a):
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input()) 
A = int(input())
if A >= N % 500:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if (n % 500) <= a:
  print("Yes")
else:
  print("No")

Solution (Python):

n=int(input())
a=int(input())
temp=n%500
print('Yes' if temp<=a else 'No')

Solution (Python):
N = int(input())
A = int(input())


ans = 'No'
if N % 500 <= A:
    ans = 'Yes'
print(ans)

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if n % 500 <= a else 'No')

Solution (Python):
N=int(input())
A=int(input())
for i in range(0,20):
  if N >= 500:
    N=N-500
  else:
    break
if(N<=A):
  print("Yes")
else:
  print("No")

Solution (Python):


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    N = int(input())
    A = int(input())
    if N % 500 > A:
        print(No)
    else:
        print(Yes)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A :
  	print("Yes")
else:
  	print("No")

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A :
    print("Yes")
else :
    print("No")

Solution (Python):
N=int(raw_input())
A=int(raw_input())
print "Yes" if (N%500)<=A else "No"

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
print("No" if  n%500>int(input()) else "Yes")

Solution (Python):
n=int(input());a=int(input())
n-=500*(n//500)
if a>=n: print("Yes")
else: print("No")

Solution (Python):
n = 2
N = []
for i in range(n):
    N.append(int(input()))
if (N[0] % 500) <= N[1]:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())

print("Yes" if N%500<=A else "No")

Solution (Python):
a = int(input())
b = int(input())
if a%500 <= b:
    print('Yes')
else:
    print('No')

Solution (Python):
N,A=int(input()),int(input())
print('Yes' if N%500<=A else 'No')

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
if ((N % 500) > A):
    print("No")
else:
    print("Yes")

Solution (Python):
x=[]
for i in range(2):
    x.append(int(input()))

y = x[0]%500

if y<=x[1]:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 == 0:
    print("Yes")
elif n % 500 - a <= 0:
    print("Yes")    
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
B = N % 500
if A >= B :
    print("Yes")
else :
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if(n%500 > a):
    print("No")
else:
    print("Yes")

Solution (Python):
def solve():
    n = int(input())
    
    a = int(input())
    amari = n % 500
    if amari - a <= 0:
        print("Yes")
    else:
        print("No")
solve()

Solution (Python):
N=int(input())
A=int(input())
if N%500<=A:
  print("Yes")
else:
  print("No")

Solution (Python):
n, a = map(int, [input() for i in range(2)])
if n % 500 <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
if A >= N % 500:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

print("Yes" if n%500 <= a else "No")

Solution (Python):
n = int(input())
a = int(input())

if (n % 500) - a <= 0:                                                                                            
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

if (N % 500 <= A):
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a=int(input())
print("Yes" if n%500<=a else "No")

Solution (Python):


def main():
    n = int(input())
    a = int(input())

    if n % 500 <= a:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if (N%500)<=A else 'No')

Solution (Python):
N,A = int(input()),int(input())
print('Yes' if N%500 <= A else 'No')

Solution (Python):

n=int(input())	
a=int(input())	
 
if a >= 499:
    print('Yes')
else:
    if n%500>a:
        print('No')
    else:
        print('Yes')

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if N%500 <= A else 'No')

Solution (Python):
money = int(input())
number_money = int(input())

division = money // 500
difference = money - 500*division
if difference <= number_money:
    print("Yes")

else:
    print("No")

Solution (Python):
print("Yes" if (int(input()) % 500) <= int(input()) else "No")

Solution (Python):
N = int(input())
A = int(input())

if A < N % 500:
  print('No')
else:
  print('Yes')

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(raw_input())
a = int(raw_input())
print "Yes" if a >= n%500 else "No"

Solution (Python):
n,a=[int(input()) for i in range(2)]
if n%500<=a:
  print('Yes')
else:
  print('No')

Solution (Python):
money=int(input())
if money%500>int(input()):
    print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())
a = int(input())
if n%500 > a:
  print('No')
else:
  print('Yes')

Solution (Python):
n=int(input())
a=int(input())
if n%500 - a <=0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
num = int(N/500)
res = N - 500*num
if A < res:
  print('No')
else:
  print('Yes')

Solution (Python):
N = int(input())
A = int(input())
r = N%500
if r > A:
  print('No')
else:
  print('Yes')

Solution (Python):
N = int(input())
A = int(input())
if (N % 500) <= A:
	print("Yes")
else:
	print("No")

Solution (Python):
N = int(input())
A = int(input())

num = N%500

if num <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
A=int(input())
if N%500==0:
    print('Yes')
else:
    while N>500:
        N=N-500
    if N<= A:
        print('Yes')
    else:
        print('No')

Solution (Python):
n = int(input())
a = int(input())

n = n % 500
if n <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())

if N%500<=A:
  print('Yes')
else:
  print('No')

Solution (Python):
n=int(input())
a=int(input())
print(['No','Yes'][n-(n//500)/(1/500)-a<=0])

Solution (Python):
a = int(input())
c = int(input())
b = 0
 
b = a% 500
if c >= b:
    print('Yes')
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if (n % 500) <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a = int(input())
print('Yes' if n%500<=a else 'No')

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a: 
    print('Yes')
else:
    print('No')

Solution (Python):
[n,a]=[int(input()) for i in range(2)]
if n-500*(n//500)<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if N % 500 <= A else 'No')

Solution (Python):
N=int(raw_input())
A=int(raw_input())
if N % 500 <= A:
  print 'Yes'
else:
  print 'No'

Solution (Python):
A = int(input())
B = int(input())
if A % 500 <= B:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())


print("Yes" if N%500 <= A else "No")

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
print(['Yes','No'][int(input())%500>int(input())])

Solution (Python):
n=int(input())
a=int(input())
print("Yes" if n%500<=a else "No")

Solution (Python):
print('Yes' if int(input()) % 500 <= int(input()) else 'No')

Solution (Python):
n = int(input())
a = int(input())

print(['No', 'Yes'][n%500 <= a])

Solution (Python):
N = int(input())
A = int(input())

if (N % 500) <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if a >= n%500:
  print("Yes")
else:
  print("No")

Solution (Python):

"""
Created on Fri Jun 15 11:27:37 2018

@author: Yuya
"""

N = int(input())
A = int(input())

if N%500 > A:
    print("No")
else:
    print("Yes")

Solution (Python):
print('Yes' if int(input())%500<=int(input()) else 'No')

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

Solution (Python):
N = int(input())
A = int(input())

if N%500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):



N=int(input())
A=int(input())

nokori=N%500

if A>=nokori:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
if (N % 500) <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
print['Yes','No'][input()%500>input()]

Solution (Python):
print('Yes' if int(input())%500<=int(input()) else 'No')

Solution (Python):
if int(input())%500<=int(input()):print('Yes')
else:print('No')

Solution (Python):
N = int(input())
A = int(input())
a = N - 500 * (N // 500)
if a <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
print('Yes' if N % 500 <= int(input()) else 'No')

Solution (Python):


N = int(input())
A = int(input())


if N / 500 == 0:
    print("Yes")

else:
    
    mod = N % 500
    if A >= mod:
        print("Yes")
    else:
        print("No")

Solution (Python):
s = [int(input()) for i in range(2)]
if s[0] % 500 <= s[1]:
    print('Yes')
else :
    print('No')

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

number = int(input())
a = int(input())

if a >= 499:
  print("Yes")
  sys.exit()

for i in range(a + 1):
  if number % 500 == i:
    print("Yes")
    sys.exit()

print("No")

Solution (Python):
print(['Yes','No'][int(input())%500>int(input())])

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
pay = int(input())
money_one = int( input() )

if( money_one >= pay%500 ):
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

output = "Yes" if (N % 500) <= A else "No"
print(output)

Solution (Python):
N = int(input())
A = int(input())

if A >= (N % 500):
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
A=int(input())
 
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())

oneyen = N%500
if oneyen<=A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
A=int(input())
 
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print('Yes')
else:
  print('No')

Solution (Python):

while True:
    N = int(input())
    A = int(input())
    if (N >= 1 and N <= 10000) and (A >= 0 and A <= 1000):
        break

if (N / 500) > 0:
    x = N % 500
    if A >= x:
        print('Yes')
    else:
        print('No')
else:
    if A >= N:
        print('yes')
    else:
        print('No')

Solution (Python):
N=int(input())
A=int(input())

if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())

if(N%500==0|N%500<=A):
	print("Yes")
	
else:
	print("No")

Solution (Python):
if int(input())%500 <= int(input()):
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

if N%500 <= A :
    print("Yes")
else:print("No")

Solution (Python):
pay = int(input(''))
yen1 = int(input(''))
amari = pay % 500
if yen1 >= amari:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())  
A = int(input())  

kozeni = N % 500
if kozeni <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
remain = N % 500
if remain <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
p=input;print("Yes"if int(p())%500<=int(p())else"No")

Solution (Python):
n = int(raw_input())
a = int(raw_input())
if n % 500 <= a:
  print "Yes"
else:
  print "No"

Solution (Python):
n = int(input())
a = int(input())
coins = 'No' if a < (n%500) else 'Yes'
print(coins)

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

m = N % 500
if m <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if a>=n%500 else 'No')

Solution (Python):
n = int(input())
a = int(input())
if((n % 500) <= a):
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())
print("Yes" if N%500 <= A else "No")

Solution (Python):
N, A = int(input()), int(input())
print("Yes" if N % 500 <= A else "No")

Solution (Python):
n = int(input())
a = int(input())
n = n%500

if n <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
print(['Yes','No'][int(input())%500>int(input())])

Solution (Python):
n = int(input())
a = int(input())
n_1 = n % 500
if a >= n_1:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
n_1 = n % 500
if a >= n_1:
    print("Yes")
else:
    print("No")

Solution (Python):
a=int(input())
b=int(input())

if b-a%500>=0:
  print("Yes")
else:
  print("No")

Solution (Python):
if int(input()) % 500 <= int(input()):
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
A=int(input())
import sys
for i in range (0,1000):
    for j in range(A+1):
        if N==500*i+j:
            print ('Yes')
            sys.exit()

print ('No')

Solution (Python):
print((lambda x: "Yes" if x[0] % 500 <= x[1] else "No")([int(input()) for i in range(2)]))

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

def main():
    remnant = N % 500
    ans = "Yes" if A >= remnant else "No"
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a = int(input())

nn = n % 500

if a >= nn :
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())

if n%500>a:
    print('No')
else:
    print('Yes')

Solution (Python):
n, a = [int(input()) for _ in range(2)]
print("Yes" if n%500<=a else "No")

Solution (Python):
n = int(input())
a = int(input())
print('Yes') if n % 500 <= a else print('No')

Solution (Python):
N = int(input())

A = int(input())

if N % 500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

if N % 500 > A:
    print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())
a = int(input())

if n%500 > a:
    print('No')
else:
    print('Yes')

Solution (Python):
N = int(input())

A = int(input())

if N%500 > A:
    print('No')
else:
    print('Yes')

Solution (Python):
print(["No", "Yes"][int(input())%500 <= int(input())])

Solution (Python):
n = int(input())
a = int(input())

if n%500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    A = int(input())

    if (N % 500) <= A:
        print("Yes")
    else:
        print("No")

Solution (Python):

input_N = int(input())
input_A = int(input())

surplus_500 = input_N % 500
if surplus_500 <=  input_A:
    print("Yes")
else:
    print("No")

Solution (Python):
a = int(input())
b = int(input())

if b >= a%500:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

print("Yes" if n%500 <= a else "No")

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"


def solve():
    N = int(input())
    A = int(input())

    return N % 500 <= A


def main():
    print(Yes if solve() else No)


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
A=int(input())


if int(N%500)<=A:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
   print('Yes')
else:
   print('No')

Solution (Python):
N = int(input())
A = int(input())
print("Yes" if A >= N%500 else "No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
v = int(input()) % 500
print("Yes" if v <= int(input()) else "No")

Solution (Python):
N = int(input())
A = int(input())
print("Yes" if N%500<=A else "No")

Solution (Python):
a=int(input())
b=int(input())
if(a%500 <= b):
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
 
if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):


n = int(input()) 
a = int(input()) 

cal = n % 500 

if a >= cal:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
A=int(input())
a=int(N/500)
if N-a*500<=A:
    print("Yes")
else :
    print("No")

Solution (Python):
N = int(input())
A = int(input())
if N%500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())


if (N % 500) >  A:
    print("No")

else:
    print("Yes")

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if n % 500 <= a else 'No')

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

if (n % 500) <= a:
    print('Yes')
else:
    print('No')

Solution (Python):


if __name__ == "__main__":
    N = int(input())
    A = int(input())
    
    if (N%500) <= A:
        print("Yes")
    else:
        print("No")

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
	print('Yes')
else:
	print('No')

Solution (Python):
n = int(input())
a = int(input())

x = n % 500
if x <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
                                                                                                                           
print('Yes' if n % 500 <= a else 'No')

Solution (Python):
N = int(input())
A = int(input())

r = N % 500
if r <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = input()
a = input()
x = int(n) % 500

if x <= int(a):
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
c = n % 500
if c <= a:
	print('Yes')
else:
	print('No')

Solution (Python):
n = int(input())
a = int(input())

r = n % 500
if r > a:
  print('No')
else:
  print('Yes')

Solution (Python):
import math
import sys

def getinputdata():

    
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])


a = int(arr_data[1][0])


cnt =n //500



print("Yes" if n-cnt*500<=a else "No")

Solution (Python):
n = int(input())
a = int(input())

need_coin = n % 500

if need_coin <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input()) % 500
print(['No', 'Yes'][int(input()) >= N])

Solution (Python):
print("Yes" if int(input())%500 <= int(input()) else "No" )

Solution (Python):
N = int(input())
A = int(input())

if N%500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a=int(input())
b=int(n%500)
if a>=b:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
amari = n % 500
if amari <= a :
    print('Yes')
if amari > a :
    print('No')