Smallest Positive Integer

4.1

9 votes
Mathematics, Easy-Medium
Problem

Given a number X between 0 to 1000000006 find smallest positive integer Y such that the products of digits of Y modulo 1000000007 is X.

Input Format

A single integer - X

Output Format

A single integer - Y

Input Constraint

0 <= X <= 1000000006

Problem Setter: Practo Tech Team

Sample Input
16
Sample Output
28
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

If x is 16 then y is 28 as (2*8)%1000000007 = 16

Editor Image

?