A number, ( x ), is called irresponsible if adding ( x ) to ( x+1 ) requires a carry operation. For example:
For ( x = 5 ): ( 5 + 6 = 11 ) involves a carry operation.
For ( x = 17 ): ( 17 + 18 = 35 ) involves a carry operation.
For ( x = 91 ): ( 91 + 92 = 183 ) involves a carry operation.
You are given two integers, ( x ) and ( n ). Your task is to construct a new number ( s ) by repeating ( x ) a total of ( n ) times. For example, if ( x = 3121 ) and ( n = 4 ), then ( s = 3121312131213121 ).
Objective
Given ( x ) and ( n ):
Construct ( s ).
Find all irresponsible numbers between ( 1 ) and ( s ).
Print the count of these irresponsible numbers modulo ( 10^9 + 7 ).
Input Format
A single line containing two space-separated integers ( x ) and ( n ):
( 1 \leq x \leq 10^{1,000,000} )
( 1 \leq n \leq 10^{18} )
Output Format
A single integer representing the number of irresponsible numbers between ( 1 ) and ( s ), modulo ( 10^9 + 7 ).
Examples
Example 1
Input:
text
1 2
Output:
text
4
Explanation:
When we repeat ( x = 1 ) a total of ( n = 2 ) times, we get ( s = 11 ). The irresponsible numbers between ( 1 ) and ( 11 ) are ( 5, 6, 7, ) and ( 8 ). Thus, the output is ( 4 ).
Implementation
Your solution should be implemented in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.