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-----
2018
218

-----Sample Output-----
Yes

We can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.

Difficulty: introductory

Starter code:

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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


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

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

# -*- coding: utf-8 -*-

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

remainder = N % 500
if A > remainder or remainder==0:
    print("Yes")
else:
    print("No")

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

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

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


main()

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


n = int(input())
a = int(input())
cnt = 0
for i in range(21):
  if 0 <= n - i*500 and n - i*500 <= a:
    print("Yes")
    break
  else:
    cnt += 1
    if cnt == 21:
      print("No")
      break

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

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

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

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


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

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

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

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

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

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

#!/usr/bin/env python3

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

num = n % 500

if num > a:
    print("No")
else:
    print("Yes")


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

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

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


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

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


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


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


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

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

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

total_price = int(input())
num_one_coin = int(input())

mod = total_price % 500

if num_one_coin >= mod:
    print('Yes')
else:
    print('No')

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

import sys
n = int(input())
a = int(input())
b = 0
while True:
    c = 0
    if (500*b + c) > n:
        print("No")
        break
    for i in range(a+1):
        if (500*b + c) == n:
            print("Yes")
            return
        c+=1
    b+=1


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

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

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

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


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


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

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

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

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

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

b = N%500

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

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

N = int(input())
A = int(input())
m = N % 500

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

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

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




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

Amari=N%500

if A>=Amari:
    print('Yes')

elif A<Amari:
    print('No')

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

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

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

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

nokori = N % 500

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


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


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

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

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

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

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

# 整数の入力
N = int(input())
# 整数の入力
A = int(input())
 
x = N % 500
if x <= A:
    print("Yes")
else:
    print("No")

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

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

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


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

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

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

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

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

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

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


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

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

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

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


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

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

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

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

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

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

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

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

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


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

#!/usr/bin/env python3


def main():
    N, A = list(map(int, open(0).read().split()))
    if N % 500 <= A:
        print("Yes")
    else:
        print("No")


main()


#!/usr/bin/env python3


def main():
    N, A = list(map(int, open(0).read().split()))
    if N % 500 <= A:
        print("Yes")
    else:
        print("No")


main()


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

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

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


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


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

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

#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


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


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    print((solve(N, A)))

def test():
    import doctest
    doctest.testmod()

def __starting_point():
    #test()
    main()

__starting_point()

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

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


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

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

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

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

import sys
N, A = map(int, sys.stdin.readlines())
N %= 500
print('Yes' if N <= A else 'No')

n, a = int(input()), int(input())
flg = n % 500 - a > 0

print('No' if flg else 'Yes')

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

a = N % 500

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

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

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

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

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

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