Summits on the Odometer
An observatory displays each positive integer as a row of decimal digits. Consecutive equal digits form a plateau.
More precisely, compress every maximal contiguous group of equal digits in the usual decimal representation of an integer into one digit. Let the resulting plateau sequence be
A plateau is a summit if
Thus, the first and last plateaus are never summits.
The digit sum of , denoted by , is the sum of all digits in its usual decimal representation, including repeated digits inside a plateau.
Given an interval and integers , , and , count the integers in the interval that satisfy both conditions:
- the plateau sequence of contains exactly summits;
- .
Because the count can be large, report it modulo .
Input
The first line contains the decimal representation of .
The second line contains the decimal representation of .
The third line contains three integers , , and .
The constraints are:
- ;
Output
Print the number of integers in the interval that have exactly summit plateaus and satisfy the required digit-sum congruence. Print the answer modulo .
Samples
Sample 1
Input
1 150 1 3 0
Output
4
The qualifying integers are , , , and .
Sample 2
Input
1210 1222 1 7 6
Output
3
The qualifying integers are , , and . In , the plateau containing the two equal digits is a summit.