jkrt does not know bit operations, so for two nonnegative integers , jkrt defines as the length of the LCS of the decimal representations of and .
Here, LCS means the longest common subsequence. For example, is a common subsequence of the decimal representations of and , and there is no longer common subsequence. Therefore,
List all positive integers satisfying
in increasing order. Let be the -th such number.
Given a positive integer , compute modulo .
Input
The input is given in the following format.
Output
Print modulo .
Constraints
- is given in decimal notation and is a positive integer.
- .
- The decimal representation of has no leading zero.
Subtasks
Samples
예제 1
입력
1
출력
1
Since , we have .
예제 2
입력
10
출력
10
The sequence starts with . Therefore, .
예제 3
입력
18
출력
100
are , and the next value is .
해설
관리자가 작성한 해설을 별도 페이지에서 볼 수 있어요.