Problems
Product of digits
Product of digits
Given an integer n. Write a program to find the minimal positive integer k such that the product of its digits is exactly n.
Input
There are several tests. Each test consists of an integer n (0 ≤ n ≤ 109
) on a single line.
Output
For each integer print in a single line the corresponding number k. If such k doesn't exist, print -1 instead.
Input example #1
15 128 255
Output example #1
35 288 -1