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):
def main():
    n = int(input())
    a = int(input())

    x = n % 500

    if x <= 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 = int(input())
A = int(input())

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

Solution (Python):
print('NYoe s'[(int(input())%500)<=int(input())::2])

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

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

Solution (Python):
n = input()
a = int(input())
si = int(n[-3:])

if si > a:
    print('No')
else:
    print('Yes')

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

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

S = (N - int(N / 500) * 500)

if S <= A:
  print('Yes')
  
elif S > A:
  print('No')

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

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

Solution (Python):
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): 
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): 
    return a/gcd(a,b)*b

def divisors(a): 
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): 
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): 
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): 
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

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

if __name__=='__main__':
    main()

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

n -= 500*(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())
yen = int(input())

diff = N % 500
print("Yes" if diff <= yen 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())
 
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 = input()
A = int(input())
n = int(N)
x = 0

if n > 100:
    x = int(N[-3])
    if x >= 5:
        x = x - 5

y = int(N[-2])
z = int(N[-1])
X = x * 100 + (y * 10) + z

if n <= A or X <= 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('YNeos'[a<n%500::2])

Solution (Python):
import sys
input = sys.stdin.readline
n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

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

Solution (Python):

N = int(input())

A = int(input())

pay = N%500

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
A = int(input())
if A-N%500 < 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 N % 500 > A:
    print("No")
else:
    print("Yes")

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
A = int(input())
N %= 500
if N <= A:
    print("Yes")
else:
    print("No")

Solution (Python):



def main():

    payment = int(input())
    number_of_1 = int(input())

    if (payment % 500) <= number_of_1:
        print('Yes')
    else:
        print('No')

    return 0


if __name__ == '__main__':
    main()

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

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

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

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

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

x = n - int(n / 500) * 500
if (x <= a):
   print('Yes')
else:
   print('No')

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

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

Solution (Python):
from sys import stdin


if __name__ == "__main__":
    N = int(stdin.readline())
    A = int(stdin.readline())
    
    if N%500 > 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):

import sys


def main():
  n = int(input())
  a = int(input())
  
  if n % 500 != 0 and a == 0:
    print('No')
  
  elif (n - (n // 500) * 500) <= a:
    print('Yes')
    
  else:
    print('No')
  
  return 0


if __name__ == '__main__':
  main()

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

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

if __name__ == '__main__':
    main()

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

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

Solution (Python):
y = int(input())
i = int(input())

z = y%500
if z <= i:
  print("Yes")
else:
  print("No")

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

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

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

Solution (Python):
import sys

n, a = map(int, sys.stdin.read().split())

def main():
    return 'Yes' if a >= n % 500 else 'No'

if __name__ == '__main__':
    ans = main()
    print(ans)

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

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

Solution (Python):


N=int(input())

A=int(input())

for i in range(A+1):
    if (N-i)%500==0:
        print("Yes")
        break
    elif i==A:
        print("No")


"""
2018
218

Yes

2763
0

No

37
514

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

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

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

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

Solution (Python):
import sys

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

for i in range(21):
  if 0<= n-500*i<=a:
    print("Yes")
    break
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())
s=n%500
if s>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())
s = int(input())
if n%500 <= s:
    print('Yes')
else:
    print('No')

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

rest = N % 500

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

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

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

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

b = int(n%500)

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

Solution (Python):
def can_pay(n,a):
  n %= 500
  print("Yes") if(n<=a) else print("No")


n = int(input())
a = int(input())
can_pay(n,a)

Solution (Python):


yes = "Yes"
no = "No"


def solver(total, haveOneYen):

    result = False
    oneYenNeed = total % 500
    if oneYenNeed <= haveOneYen:
        result = True
    return result


if __name__ == "__main__":

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

Solution (Python):

import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

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

Solution (Python):

import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

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

Solution (Python):

import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

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

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

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

Solution (Python):
s = [int(input()) for i in range(2)]

s[0] %= 500
if s[0] <= s[1]:
    print('Yes')
else:
    print('No')

Solution (Python):


yes = "Yes"
no = "No"


def canpay(needMoney, oneYen):
    zangaku = needMoney % 500
    if zangaku <= oneYen:
        return True
    else:
        return False


if __name__ == "__main__":

    N = int(input())
    A = int(input())
    result = True
    if canpay(N, A):
        print(yes)
    else:
        print(no)
exit

Solution (Python):
g=int(input())
i=int(input())

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

Solution (Python):


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

left = N % 500

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

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

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

Solution (Python):




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

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

Solution (Python):


if __name__ == "__main__":
    yes = "Yes"
    no = "No"
    answer = ""
    N = int(input().strip())
    A = int(input().strip())
    chargeCoin = N % 500
    if chargeCoin <= A:
        answer = yes
    else:
        answer = no
    print(answer)
exit

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

_, r = divmod(N, 500)
if r <= 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())
print('YNeos'[n % 500 > a::2])

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

T = N // 500
U = N - (T * 500)
if U <= 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:
  print("Yes")
else:
  print("No")

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = INT()
left = N % 500
if left <= 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):
input = [int(input()) for i in range(2)]
if input[0] % 500 <= input[1]:
   print("Yes")
else:
    print("No")

Solution (Python):
n = int(input().split()[0])
a = int(input().split()[0])
ans = "Yes" if n % 500 <= a else "No"
print(ans)

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

x=n%500 

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

Solution (Python):
import sys

def main():
    n, a = map(int, sys.stdin.read().split())
    print('Yes' if n % 500 <= a else '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())%500
a = int(input())
print('Yes') if n <= a else print('No')

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

tmp = n % 500

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

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

Solution (Python):
n, a = open(0).read().split()
if int(n) % 500 <= int(a):
        print("Yes")
else:
        print("No")

Solution (Python):

import math




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

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

Solution (Python):
N = int(input())
A = int(input())
is_OK = False
for a in range(A + 1):
    if (N - a) % 500 == 0:
        print("Yes")
        is_OK = True
        break
if is_OK == False: 
    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())


number=(N//500)


Rest = (N-(number*500))

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

Solution (Python):

import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

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

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

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

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

mod = N % 500

res = 'Yes' if mod <= A else 'No'
print(res)

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 print('No')

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

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

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

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

Solution (Python):
def examA():
    N = I(); A = I()
    ans = "No"
    if N%500<=A:
        ans = "Yes"
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

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())
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):
from sys import stdin
from itertools import combinations

n = int(stdin.readline().rstrip())
a = int(stdin.readline().rstrip())

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

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

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

N = N % 500

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

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):
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:
    ans = "Yes"
else:
    ans = "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())
residue = n % 500
if residue <= 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(A+1):
  if (N - i) % 500 == 0:
    print('Yes')
    exit()

print('No')

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

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

Solution (Python):
import sys
input = sys.stdin.readline
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):
def main():
  N = int(input())
  A = int(input())
  left = N % 500
  print('Yes' if left <= A else 'No')

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):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1

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

main()

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 and a>=n:
  print("Yes")
elif n>=500 and 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):
from sys import stdin
n = int(stdin.readline().rstrip())
a = int(stdin.readline().rstrip())

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

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

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

Solution (Python):


import sys








def main():
    n, a = (int(x) for x in sys.stdin.read().split())
    print('Yes' if n % 500 <= a else '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())
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):
if int(input())%500 <= int(input()):
  print("Yes")
else:
  print("No")

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

N = N%500

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

Solution (Python):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N=one_int()
A=one_int()

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

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

div, mod = divmod(N, 500)

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

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

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

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

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

if N - (L * 500) - A <=0:
    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 - (N // 500) * 500 <= A:
  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('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())

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