Company: Intuit
Difficulty: medium
Peter's Number Peter is fond of picking out digit strings with unusual properties. This time he wants an n-digit number whose digits add up to exactly s, and among all numbers meeting that condition he wants the numerically largest one. Leading zeroes are not allowed, since that would make the value shorter than n digits. Work out that maximum number for him, or report that no such number can be built. Input Format The first line of input contains an integer n, representing the number of digits in the requested number. The second line of input contains s, representing the sum of its digits. Output Format Print the requested number if it exists or -1 otherwise. Constraints 1 ≤ n ≤ 10 5 0 ≤ s ≤ 10 6 Examples Example #1 Input: 1 5 Output: 5 Explanation: with a single digit available and a target digit sum of five, the only candidate is the digit 5 itself. Example #2 Input: 2 15 Output: 96 Explanation: a two-digit value such as 87 also sums to 15, but 96 is chosen since it is the larger of