eolymp
bolt
Try our new interface for solving problems
Problems

Product of digits

Product of digits

Find the largest positive integer which product of digits equals to the positive integer m, or print -1 if there no such number. Numbers that contain digits 0 and 1 are not considered.

Input

One integer m (2m103).

Output

Print the largest positive integer which product of digits equals to m. Print -1 if such number does not exist.

Time limit 1 second
Memory limit 128 MiB
Input example #1
12
Output example #1
322
Source 2019 All-Ukrainian Olympiad, Zhitomyr region, ІІ stage