Infinite Coins

AtCoder
IDabc088_a
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
2018
218
Output #1
Yes

We can pay $2018$ yen with four $500$\-yen coins and $18$ $1$\-yen coins, so the answer is `Yes`.
Input #2
2763
0
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.
Input #3
37
514
Output #3
Yes
API Response (JSON)
{
  "problem": {
    "name": "Infinite Coins",
    "description": {
      "content": "E869120 has $A$ $1$\\-yen coins and infinitely many $500$\\-yen coins.   Determine if he can pay exactly $N$ yen using only these coins.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc088_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "E869120 has $A$ $1$\\-yen coins and infinitely many $500$\\-yen coins.  \nDetermine if he can pay exactly $N$ yen using only these coins.\n\n## Constraints\n\n*   $N$ is an integer between $1$ and $10000$ (i...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments