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.
[{"code": "n=int(input())\na=int(input())\nif n%500<=a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14072.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n % 500 <= a:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.26, "memory": 14072.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nprint('Yes' if (n % 500) <= a else 'No')", "passed": true, "time": 0.2, "memory": 14316.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nmod = n % 500\nif mod > a:\n    print(\"No\")\nelse:\n    print(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n%500<=a:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.16, "memory": 14172.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nprint('Yes' if n %500 <= a else 'No')", "passed": true, "time": 1.64, "memory": 14092.0, "status": "done"}, {"code": "a,b=int(input()),int(input())\nprint(\"Yes\") if a%500<=b else print(\"No\")", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n\nif n%500 <= a:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.14, "memory": 14048.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n\nif a >= n % 500:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.4, "memory": 14272.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nN %= 500\nprint(\"Yes\" if N <= A else \"No\")", "passed": true, "time": 0.3, "memory": 14264.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nmod = N % 500\nif mod <= A:\n    print(\"Yes\")\nelse:\n    print(\"No\")\n", "passed": true, "time": 1.51, "memory": 14096.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nx = n % 500\nprint(\"Yes\" if a >= x else (\"No\"))", "passed": true, "time": 0.28, "memory": 14224.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nif N % 500 <= A:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.18, "memory": 14176.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\nN = int(input())\nA = int(input())\n\nremainder = N % 500\nif A > remainder or remainder==0:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.29, "memory": 14312.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif (n%500)<=a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "def main():\n    n = int(input())\n    a = int(input())\n\n    if a >= n % 500:\n        print(\"Yes\")\n    else:\n        print(\"No\")\n\n\nmain()", "passed": true, "time": 0.15, "memory": 14212.0, "status": "done"}, {"code": "N=int(input())\nA=int(input())\nif N%500>A:\n  print(\"No\")\nelse:\n  print(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\ncnt = 0\nfor i in range(21):\n  if 0 <= n - i*500 and n - i*500 <= a:\n    print(\"Yes\")\n    break\n  else:\n    cnt += 1\n    if cnt == 21:\n      print(\"No\")\n      break", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nif N%500 <= A:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.23, "memory": 14200.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n\nif n % 500 <= a:\n  print(\"Yes\")\nelse:\n  print(\"No\")\n", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "a = int(input())\nb = int(input())\nx = a % 500\nif x <= b:\n  print('Yes')\nelse:\n  print('No')", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nif N % 500 <= A:\n   print('Yes')\nelse:\n   print('No')", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif a>=(n%500):\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nn1 = n % 500\nif n1 <= a:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "N=int(input())\nA=int(input())\nN %= 500\nif N>A:\n    print('No')\nelse:\n    print('Yes')", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\nn = int(input())\na = int(input())\n\nnum = n % 500\n\nif num > a:\n    print(\"No\")\nelse:\n    print(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "a = [int(input()) for i in range(2)]\nif(a[0]%500 <= a[1]): print(\"Yes\")\nelse: print(\"No\")", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nif A >= (N % 500):\n  print(\"Yes\")\nelse:\n  print(\"No\")\n", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "a = int(input()) % 500\nichi = int(input())\nif ichi >= a:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.14, "memory": 14096.0, "status": "done"}, {"code": "n=int(input())\na=int(input())\ns=n%500\nif s<=a:\n  print(\"Yes\")\nelse:\n  print(\"No\")\n", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nif N % 500 <= A:\n  print(\"Yes\")\nelse:\n  print(\"No\")\n", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n % 500 <= a:\n    print(\"Yes\")\nelse:\n    print(\"No\")\n", "passed": true, "time": 0.15, "memory": 14040.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n\nif a >= (n%500):\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.17, "memory": 14068.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n % 500 <= a:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.17, "memory": 14064.0, "status": "done"}, {"code": "total_price = int(input())\nnum_one_coin = int(input())\n\nmod = total_price % 500\n\nif num_one_coin >= mod:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "n=int(input())\na=int(input())\nif n%500 <=a:\n    print(\"Yes\")\nelse : print(\"No\")", "passed": true, "time": 0.14, "memory": 14212.0, "status": "done"}, {"code": "import sys\nn = int(input())\na = int(input())\nb = 0\nwhile True:\n    c = 0\n    if (500*b + c) > n:\n        print(\"No\")\n        break\n    for i in range(a+1):\n        if (500*b + c) == n:\n            print(\"Yes\")\n            return\n        c+=1\n    b+=1\n", "passed": true, "time": 0.14, "memory": 14064.0, "status": "done"}, {"code": "n=int(input())\na=int(input())\n\nif n%500<=a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n\nif n % 500 <= a:\n    print('Yes')\nelse:\n    print('No')\n", "passed": true, "time": 0.15, "memory": 14108.0, "status": "done"}, {"code": "N=int(input())\nA=int(input())\nif N%500<=A:\n    print(\"Yes\")\nelse:\n    print(\"No\")\n", "passed": true, "time": 0.14, "memory": 14044.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nif N%500 > A:\n    print(\"No\")\nelse:\n    print(\"Yes\")", "passed": true, "time": 0.15, "memory": 14232.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n%500<=a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.22, "memory": 14200.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nb = n % 500\nif a >= b:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.15, "memory": 14256.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nif N%500 <= A:\n  print('Yes')\nelse:\n  print('No')", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nb = N%500\n\nif A >= b:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "a = int(input())\nb = int(input())\nif a % 500 <= b:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nm = N % 500\n\nif m <= A:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "N=int(input())\nA=int(input())\nif N%500<=A:\n    print('Yes')\nelse :\n    print('No')", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n%500 <= a:\n  print(\"Yes\")\nelse:\n  print(\"No\")\n\n\n", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "N=int(input())\nA=int(input())\n\nAmari=N%500\n\nif A>=Amari:\n    print('Yes')\n\nelif A<Amari:\n    print('No')", "passed": true, "time": 0.14, "memory": 14040.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n%500<=a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 13992.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nanswer = \"Yes\" if N % 500 <= A else \"No\"\nprint(answer)", "passed": true, "time": 0.14, "memory": 14072.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nnokori = N % 500\n\nif nokori <= A:\n    print(\"Yes\")\nelse:\n    print(\"No\")\n", "passed": true, "time": 0.23, "memory": 14240.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n % 500 <= a:\n  print('Yes')\nelse:\n  print('No')\n", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n\ndiv = n % 500\nif div <= a:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.16, "memory": 14328.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nprint(\"Yes\" if n%500 <= a else \"No\")", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "n=int(input())\na=int(input())\nif a>=n%500:print(\"Yes\")\nelse:print(\"No\")", "passed": true, "time": 0.23, "memory": 14224.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nprint('Yes' if a - n%500 >= 0 else 'No')", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "# \u6574\u6570\u306e\u5165\u529b\nN = int(input())\n# \u6574\u6570\u306e\u5165\u529b\nA = int(input())\n \nx = N % 500\nif x <= A:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.23, "memory": 14324.0, "status": "done"}, {"code": "n,a=[int(input()) for i in range(2)]\nprint(\"Yes\" if n%500<=a else \"No\")", "passed": true, "time": 0.15, "memory": 14148.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n % 500 <= a:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nn -= n//500 * 500\nif n <= a:\n    print(\"Yes\")\nelse:\n    print(\"No\")\n", "passed": true, "time": 0.28, "memory": 14316.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nprint('Yes' if n%500 <= a else 'No')", "passed": true, "time": 0.23, "memory": 14084.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n%500<= a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n % 500 <= a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.17, "memory": 14104.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n \nmod = n % 500\nprint(\"Yes\" if a >= mod else \"No\")", "passed": true, "time": 0.31, "memory": 14276.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n\nprint(\"Yes\" if n%500 <= a else \"No\")", "passed": true, "time": 0.17, "memory": 14088.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nprint(('Yes' if n % 500 <= a else 'No'))\n", "passed": true, "time": 0.15, "memory": 14120.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nif N%500 > A :\n    print('No')\nelse :\n    print('Yes')", "passed": true, "time": 0.15, "memory": 14220.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n%500<=a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif (n % 500) <= a:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.14, "memory": 14068.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nprint((\"Yes\" if n%500<=a else \"No\"))\n", "passed": true, "time": 0.15, "memory": 14084.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n\nif n % 500 <= a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.15, "memory": 14068.0, "status": "done"}, {"code": "n=int(input())\na=int(input())\ns=n%500\nif a>=s:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nif N % 500 <= A:\n  print('Yes')\nelse:\n  print('No')", "passed": true, "time": 0.14, "memory": 14312.0, "status": "done"}, {"code": "N=int(input())\nA=int(input())\nif N % 500 <=A:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.14, "memory": 14056.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n % 500 <=a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nif N%500 <= A:\n  print('Yes')\nelse:\n  print('No')", "passed": true, "time": 0.14, "memory": 14060.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nif N%500 <= A:\n    print('Yes')\nelse:\n    print('No')\n", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif n - 500*(n//500) <=a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.23, "memory": 14256.0, "status": "done"}, {"code": "n=int(input())\na=int(input())\nif n%500<=a:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nif (N%500) <= A:\n    print(\"Yes\")\nelse:\n    print(\"No\")\n", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nN %= 500\nprint(\"Yes\") if A >= N else print(\"No\")\n", "passed": true, "time": 0.15, "memory": 14068.0, "status": "done"}, {"code": "n=int(input())\na=int(input())\nprint(\"Yes\" if n%500<=a else \"No\")", "passed": true, "time": 0.14, "memory": 14092.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nwhile N>=500:\n  N-=500\nif N<=A:\n  print('Yes')\nelse:\n  print('No')", "passed": true, "time": 0.22, "memory": 14056.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nimport sys\n\nYES = \"Yes\"  # type: str\nNO = \"No\"  # type: str\n\n\ndef solve(N: int, A: int):\n    return YES if (N % 500) <= A else NO\n\n\n# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools\ndef main():\n    def iterate_tokens():\n        for line in sys.stdin:\n            for word in line.split():\n                yield word\n    tokens = iterate_tokens()\n    N = int(next(tokens))  # type: int\n    A = int(next(tokens))  # type: int\n    print((solve(N, A)))\n\ndef test():\n    import doctest\n    doctest.testmod()\n\ndef __starting_point():\n    #test()\n    main()\n\n__starting_point()", "passed": true, "time": 0.23, "memory": 14152.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nprint(\"Yes\" if n%500 <=a else \"No\")", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "N, A = [int(input()) for i in range(2)]\nprint('Yes') if N % 500 <= A else print('No')\n", "passed": true, "time": 0.15, "memory": 14076.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\nif N % 500 <= A:\n    print('Yes')\nelse :\n    print('No')", "passed": true, "time": 0.15, "memory": 14164.0, "status": "done"}, {"code": "n=int(input())\na=int(input())\nif n%500<=a:print('Yes')\nelse:print('No')", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\nif (N % 500) <= A:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}, {"code": "import sys\nN, A = map(int, sys.stdin.readlines())\nN %= 500\nprint('Yes' if N <= A else 'No')", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "n, a = int(input()), int(input())\nflg = n % 500 - a > 0\n\nprint('No' if flg else 'Yes')", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n\na = N % 500\n\nif A >= a:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\n\nif n%500 <= a:\n  print('Yes')\n  \nelse:\n  print('No')", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "N = int(input())\nA = int(input())\n \nif N % 500 <= A: print('Yes')\nelse: print('No')", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "a=int(input())\nb=int(input())\nif a%500 <= b:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.14, "memory": 14036.0, "status": "done"}, {"code": "n = int(input())\na = int(input())\nif a >= n % 500:\n    print(\"Yes\")\nelse:\n    print(\"No\")\n", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}]