LearnPy Hub
← Arena
EasyRating 1000

Beautiful Days

A day i is beautiful if |i − reverse(i)| is divisible by k. Count the beautiful days from i to j.

Input

Three integers i j k (1 ≤ i ≤ j ≤ 10⁶).

Output

One integer.

Sample 1

Input
20 23 6
Output
2

Sample 2

Input
1 9 1
Output
9
solution.py
Output appears here
Beautiful Days · Python Arena problem · LearnPy Hub