You are given a positive integer n. The beauty factor of a number is the sum of digits obtained till the obtained sum is a single digit.
Example
You are given a beauty factor, b. Your task is to find a minimum number (n) of length k whose beauty factor is b.
Here, the length of a number is defined as the number of digits a number has.
Note: The digits of the number in the output must be distinct and must be a positive integer
Input format
The first line contains the beauty factor b (0<b<10) and the length of a number k (0<k<10).
Output format
Print the minimum number of length k whose beauty factor is b. If no such number is possible to make the beauty factor b with length k, then print −1.
This is pretty starightforward. 149 is the least number which has beauty factor of 5 and the length of number is 3.
Note : Beauty factor of 149 = 1+4+9 = 14 = 1+4 = 5