Digit multiplier
Given a positive integer N, find the smallest number S such that the product of all the digits of S is equal to the number N.
Input: The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains a positive integer N.
Output: Print out the number S. If there exists no such number, then print -1.
Constraints: 1 <= T <= 200 1 <= N <= 109
Examples: Input: 2 100 26 Output: 455 -1
Last updated