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("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())
print('No' if N%500 > A else 'Yes')

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if N-(N//500)*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("Yes" if N==(((N//500)*500) + (N%500)) and N%500 <= A else "No")

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

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

Solution (Python):
import sys


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())
if (n % 500) > a:
    print("No")
else:
    print("Yes")

Solution (Python):
N=int(input())
A=int(input())
ans=0
for i in range(A+1):
    if (N-i)%500==0:
        ans+=1
if ans>=1:
    print('Yes')
else:
    print('No')

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

b = n % 500

if b <= 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 test():
    n = int(input())
    a = int(input())
    if (n % 500) <= a:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    test()

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

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

Solution (Python):
n=int(input())
a=int(input())
print("No") if (n%500) > a 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())

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

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

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

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

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

Solution (Python):
N, A = [int(input()) for _ in range(2)]
print('YNeos'[(N%500)>A::2])

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

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

S = N%500

print("Yes") if A >= S else print("No")

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

q, mod = divmod(N, 500)

if mod <= 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())
print('Yes' if n%500<=a else 'No')

Solution (Python):
N=int(input())
A=int(input())
 
N %= 500
 
if A >= N:
  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):
n, a = [int(input()) for _ in range(2)]
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):
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 = int(input()) % 500
a = int(input())

for i in range(a):
    n -= 1

if n > 0:
    print("No")
else:
    print("Yes")

Solution (Python):
n,a=[int(input()) for i in range(2)]
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 =map(int, open(0))

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

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

if a >= 499:
  print('Yes')
elif 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())
num = 0
while N - 500*num >= 0:
  num += 1
num1 = N - 500 * (num-1)
if num1 <= A:
  print("Yes")
else:
  print("No")

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

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

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

Solution (Python):
N,A =map(int,open(0).read().split())
print("Yes" if N//500*500+A >= N else "No")

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

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

print('YNeos'[n%500>a::2])

Solution (Python):

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

print('Yes' if n%500 <= a else '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()), int(input())

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

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

Solution (Python):

n = int(input())
a = int(input())
temp = n%500
if temp <= 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 a >= (n % 500) :
  print("Yes")
else :
  print("No")

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

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

else:
    if ( A >= N):
        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 = int(input())
a = int(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())

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

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

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

main()

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

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

Solution (Python):
N = int(input());
A = int(input());
C = 0;
C = N % 500;
if C <= 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 = int(input())
a = int(input())
 
if n % 500 <= a:
    print('Yes')
else:
    print('No')

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

b = n % 500
if b <= 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())
b = n % 500
if b <= a:
  print('Yes')
else:
  print('No')

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

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

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

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

Solution (Python):
total = int(input())
one_yen_coins = int(input())

print("Yes" if total % 500 <= one_yen_coins else "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())

s = N % 500

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

Solution (Python):
n = int(input()) % 500
a = int(input())
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())

N %= 500

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

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

a = int(input())

tmp = n % 500

if(tmp <= 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, a = [int(input()) for _ in range(2)]
print('Yes' if (n % 500) <= a else '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())
flg = False

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

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

t = N % 500
if A-t>=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 A>=N-(N//500)*500:
    print('Yes')
else:
    print('No')

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

Solution (Python):
print('No' if max(int(input()) % 500 - int(input()), 0) else 'Yes')

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

ans = N % 500
if max(ans - A, 0):
  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())

if (A==0) and (N%500 == 0):
    print('Yes')
elif (A != 0) and (A >= N%500):
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
b = N%500
if b<=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,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())
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):
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,a=map(int,open(0));print("YNeos"[n%500>a::2])

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

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

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())

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):
a = int(input())
b = int(input())
if (a%500) <= b:
    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 = int(input())
a = int(input())

while n >= 500:
    n -= 500

print("Yes" if n <= 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):
N=int(input())
A=int(input())

B=N%500

if B>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())
print("Yes" if A >= N%500 else "No")

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

Solution (Python):
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


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

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

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

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

Solution (Python):

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

main()

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 i in range(a + 1):
    if (n - i) % 500 == 0:
        print("Yes")
        quit(0)
    else:
        continue

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())
print("Yes" if N % 500 <= A else "No")

Solution (Python):
x = int(input())
y = int(input())
for i in range(y+1):
  if x - (int(x/500)*500 + i) == 0:
    print('Yes')
    break
  elif i == y:
    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):
n = int(input())
a = int(input())
if a >= n%500:
  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 = 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):
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):
i1 = int(input())
i2 = int(input())

w = i1%500
if w <= i2:
  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):
import math
n = int(input())
a = int(input())
n1 = math.floor(n / 500)
if n - (n1 * 500 + a) <= 0:
	print("Yes")
else:
	print("No")

Solution (Python):
import numpy as np

n = int(input())
a = int(input())
flag = False

for i in range(0,a+1):
    if (n-i)%500 == 0:
        flag = True
        break

if flag:
    print("Yes")
else:
    print("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())
n %= 500
if n <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())%500
A = int(input())
print("No") if A < N 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())
if n<a:
    print("Yes")
    exit()
if n % 500 <= a:
    print("Yes")
else:
    print("No")

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

s = n % 500

if a >= s:
    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())

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

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

Solution (Python):
N = int(input())
A = int(input())
N_500 = N%500
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())

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

Solution (Python):
n,a=map(int,open(0))
print('YNeos'[n%500>a::2])

Solution (Python):
n = int(input())
a = int(input())
if int(n) < 500 :
  if a >= n :
    print("Yes")
  else :
    print("No")
  
elif 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):

import sys

YES = "Yes"  
NO = "No"  


def solve(N: int, A: int):
    if (N % 500) <= A:
        print(YES)
    else:
        print(NO)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    solve(N, A)


if __name__ == '__main__':
    main()

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 == 0 and A<N:
    print('No')
elif A < N%500:
    print('No')
else:
    print('Yes')

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

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

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    n, a = IR(2)
    n %= 500
    if a >= n:
        print("Yes")
    else:
        print("No")
    return


def B():
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    A()

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

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

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

Solution (Python):
n = int(input())
a = int(input())
ans = 'No'
x = n // 500
if n - x * 500 <= a:
    ans = 'Yes'
print(ans)

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):
def main():
    N = int(input())
    A = int(input())
    if A >= N % 500:
        print("Yes")
    else:
        print("No")


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(input())
A = int(input())
if N-(N//500)*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())

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())
t=n%500

if (t<=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):
def main():
	N = int(input())
	A = int(input())
	div = N//500
	ans = N - div*500
	if ans <= A:
		print("Yes")
	else:
		print("No")


if __name__ == '__main__':
	main()

Solution (Python):



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


ans = 'Yes' if N % 500 <= A else 'No'


print(ans)

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())
if N <= A:
    print("Yes")
elif (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()) 

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

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

if N%500==0:
  print("Yes")
elif 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):
row = [input().split() for i in range(2)]
n = int(row[0][0])
a = int(row[1][0])
surplus = n % 500
if surplus <= 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())
while n>=500:
  n-=500
if n<=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 a>=r:
    print('Yes')
else:
    print('No')

Solution (Python):
a = int(input())
b = int(input())
c = a-500*(a//500)

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

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

a = N % 500

if a <= 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())

while True:
    if N - 500 >= 0:
        N -= 500
    else:
        break

if N > 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())
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())
ans =((N % 500)<= A)
if ans:
    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())
N %= 500
if N <= A:
  print("Yes")
else:
  print("No")

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

Solution (Python):

n = int(input())
a = int(input())
rest = n % 500

if a - rest >= 0:
  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())
sample = N%500
if A >= sample:
  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 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())

remainder = n % 500

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

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

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

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())
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):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
A = n()

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):
import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint

sys.setrecursionlimit(1000000)






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-(n//500)*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())
remain = n % 500
if remain <=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())
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):
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    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())
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())
print('Yes' if N % 500 <= A else 'No')

Solution (Python):
Nyen = int(input())
Amai = int(input())

if Nyen % 500 <= Amai:
	print('Yes')
else:
  	print('No')

Solution (Python):
n,a=[int(input()) for i in range(2)]
k=n%500
if k <= 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())    

amari = n%500

if amari <= 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('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())
print("Yes" if N%500<=A else "No")

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

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