#arc090d. [arc090_d]Number of Digits
[arc090_d]Number of Digits
Problem Statement
For a positive integer , let us define as the number of digits in base .
You are given an integer . Count the number of the pairs of positive integers () such that , and find the count modulo .
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
1
Sample Output 1
9
There are nine pairs that satisfies the condition: , , , .
Sample Input 2
2
Sample Output 2
98
There are pairs that satisfies the condition, such as and .
Sample Input 3
123
Sample Output 3
460191684
Sample Input 4
36018
Sample Output 4
966522825
Sample Input 5
1000
Sample Output 5
184984484