While driving to Waterloo, Max sees a car with a phone number on it: XXX 888-7777
.
Then, he wonders
How many numbers are there from that have consecutive digits that are the same (excluding leading zeros)?
Can you count these numbers for him?
Constraints
Subtask 1 [30%]
Subtask 2 [70%]
No additional constraints.
Input Specification
The first line will contain an integer, , the upper limit on the numbers to count.
The second line will contain an integer, , the number of consecutive digits that are the same.
Output Specification
Output the count of numbers between that have consecutive digits that are the same.
Sample Input 1
111
2
Sample Output 1
12
Explanation for Sample 1
The twelve numbers are , , , , , , , , , , , .
Sample Input 2
9999
2
Sample Output 2
2619
Sample Input 3
9000000000000000000
6
Sample Output 3
1132973828026002
Comments