Sort by sum of digits
The sum of a number’s digits associated with some of its properties. Particularly, by the sum of digits it is easy determine divisibility by 3 and 9. Computer scientists of Rybinsk have decided to do research of natural numbers and their sums of digits.
It is well known, that it’s easier to work with the sorted data than with unsorted. Therefore, first of all researchers decided to sort natural numbers by the sum of their digits. If some numbers have equal sums of digits, then these numbers are written in ascending order.
When scientists sorted the numbers from 1 to 20, they have got a series: 1, 10, 2, 11, 20, 3, 12, 4, 13, 5, 14, 6, 15, 7, 16, 8, 17, 9, 18, 19.
For the small quantity of numbers sorting were executed quickly. When they moved research in a wide range some difficulties were appeared to overcome. One of it was to find out the place of number K in the sorted series of N natural numbers. Your task is to solve the problem.
Write a program to calculate the position of K in the sorted series of the first N natural numbers.
Input
The single line of the input file contains two natural numbers separated by space: N and K in their decimal notation (1 ≤ K ≤ N ≤ 10^12).
Output
One natural number – position of K.