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

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

Solution (Python):
def main():
    n,a = (int(input()) for _ in range(2))
    print('Yes' if n%500 <= a else '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):

import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi

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

Solution (Python):
def actual(amount, n_1yen):
    fraction = amount % 500

    if fraction <= n_1yen:
        return 'Yes'
    else:
        return 'No'


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

print(actual(N, A))

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

_, m = divmod(N, 500)

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

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

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

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

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

cnt = N//500
if(N-cnt*500<=A):
    print("Yes")
else:
    print("No")

Solution (Python):
N,A = map(int,open(0).read().split())
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 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 i in (0,0)]
print("YNeos"[n%500>a::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())

N %= 500

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

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

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

Solution (Python):

N,A =[int(input()) for i in range(2)]
if 0 <= (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 %= 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("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())

tmp = N//500
N -= tmp * 500
if N <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
money = int(input())
one = int(input())
while money / 500 >= 1:
    money -= 500
if money <= one:
    print("Yes")
else:
    print("No")

Solution (Python):
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  
    A = int(_in[1])  
    
    TF = 'Yes' if N%500<=A else 'No'
    
    print(TF)

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:
    ans="Yes"
else:
    ans="No"
print(ans)

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

rest = n - (n//500) * 500
if rest>a:
    print("No")
else:
    print("Yes")

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

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

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        n=int(input())
        a=int(input())
        for i in range(21):
            for j in range(a+1):
                if 500*i+1*j==n:
                    return 'Yes'
        return 'No'
    print(main())
resolve()

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

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

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

Solution (Python):

data = [int(input()),int(input())]

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

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

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

mod = 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())
print(["No","Yes"][n%500<=a])

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

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

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


resolve()

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 accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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

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

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

Solution (Python):
N, A = map(int, open(0).read().split())
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())
d = n%500
if a >= d:
  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):
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):
money = int(input())
many_1_coin = int(input())
print("Yes" if (money % 500) <= many_1_coin 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):
cost = int(input())
a = int(input())
if cost % 500 <= a:
  print("Yes")
else:
  print("No")

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

Solution (Python):
p = int(input())
c1 = int(input())

change = p % 500

if (change == 0) or (c1 > change):
  print("Yes")
else:
  print("No")

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

n %= 500

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

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

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque

from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi

from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
inf = 10**17
mod = 10**9 + 7

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

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

if N-500*(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):
print(["Yes","No"][int(input())%500>int(input())])

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("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('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%500<=a])

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    A=int(input())
    YesNo(N%500<=A)

if __name__ == '__main__':
    main()

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

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

while True:
    if n >= 500:
        n -= 500
    
    else:
        break

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

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

if N-(N//500)*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):
x=int(input())
y=int(input())
if x%500<=y:
  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())
ext = N%500
if ext <= A:
    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())

B = N//500
C = N - 500*B

if C <= 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())%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("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())
n=int(input())

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

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

remainder = n % 500

if remainder <= 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('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,a = (int(input()) for _ in range(2))
print('Yes' if n%500 - a <= 0 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)==0:
  print("Yes")
elif ((N%500)-A)<=0:
  print("Yes")
elif ((N%500)-A) >0:
  print("No")

Solution (Python):
a = int(input())
n = int(input())
if a%500 <=n:
    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):
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

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

if __name__ == '__main__':
    resolve()

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

Solution (Python):
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

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

if __name__ == '__main__':
    main()

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

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

Solution (Python):

cost = int(input())
one_coins = int(input())

for i in range(one_coins+1):
  calculate = cost - i
  if (calculate % 500 == 0):
    print ("Yes")
    exit()
  else:
    pass

print("No")

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


if '__main__' == __name__:
    resolve()

Solution (Python):

import sys


YES = "Yes"  
NO = "No"  


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


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

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

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

Solution (Python):
price = int(input())
num1 = int(input())

amari = price % 500

if amari <= num1:
    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):

import sys
input = sys.stdin.readline









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

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

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

n = n - (n // 500) * 500

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

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

[print('Yes') if pay%500 <= have 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("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("Yes")
else:
    print("No")

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

ans = 0


while ans<=(N-500):
    ans += 500

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

result = a%500

if result - b <= 0:
  print("Yes")
else:
  print("No")

Solution (Python):
import math

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

n=n-math.floor(n/500)*500
if n<=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())
n = n%500
if n <= a:
  print('Yes')
else:
  print('No')

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

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

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,a=map(int,open(0))
print('YNeos'[n%500>a::2])

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

Solution (Python):
print('YNeos'[int(input())%500-int(input())>0::2])

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


result = a % 500

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

amari = N % 500
if amari > 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, A = map(int, open(0).read().split())
R = N%500
if (R <= A):
    print('Yes')
else:
    print('No')

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):
url = "https://atcoder.jp/contests/abc088/tasks/abc088_a"

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

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


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
N, A = int(input()), 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('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,A = [ int(input()) for i in range(2)]

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

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

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

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

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

B = N // 500
if N - B * 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())
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())
left = n % 500
if left > 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):
def calc():

    amari = N % 500

    if amari <= A:
        return"Yes"

    else:
        return"No"

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

print(calc())

Solution (Python):
import sys

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

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

if __name__ ==  '__main__':
    main()

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

tmp = n % 500

if tmp <= 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("Yes")
else: print("No")

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
a = ii()

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

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

if N % 500 == 0 :
	answer = "Yes"
elif N % 500   <= A:
	answer = "Yes"
else:
	answer = "No"

print(answer)

Solution (Python):
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    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:
    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())
x=n-(n//500)*500
if x>a:
  print("No")
else:
  print("Yes")

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