#SCCCIE000013. Vô hạn đồng 500 yên (Infinite Coins)
Vô hạn đồng 500 yên (Infinite Coins)
Infinite Coins
Source: AtCoder
Problem Statement
You have one-yen coins and infinitely many 500-yen coins. Determine whether you can pay exactly yen.
Input
The first line contains and the second line contains .
Output
Print Yes if exactly yen can be paid; otherwise print No.
Subtasks
- Subtask 1 (100%): ;
Examples
Example 1
Input
2018
218
Output
Yes
Explanation
For the sample values 2018, 218, evaluating the conditions in the statement gives Yes. Therefore the program prints the shown output.
Example 2
Input
2763
0
Output
No
Explanation
For the sample values 2763, 0, evaluating the conditions in the statement gives No. Therefore the program prints the shown output.
Example 3
Input
37
514
Output
Yes
Explanation
For the sample values 37, 514, evaluating the conditions in the statement gives Yes. Therefore the program prints the shown output.