#D1753. 28
28
28
Problem statement
Cards with ranks of and are powerful in card game millionaires. Therefore, we call an integer consisting of only the numbers and in decimal notation a good integer. The best integers are listed from the smallest to .
Let be a positive integer. When can be expressed in the form of a product of good integers, find the maximum product. If you can't, output .
Constraint
sample
Sample input 1
1
Sample output 1
-1
Sample input 2
2
Sample output 2
1
Sample input 3
88
Sample output 3
3
It can be expressed as .
Sample input 4
100
Sample output 4
-1
Sample input 5
173553147234869248
Sample output 5
11
It can be expressed as .
input
output
Print the answer on the line.
Example
Input
1
Output
-1
inputFormat
outputFormat
output .
Constraint
sample
Sample input 1
1
Sample output 1
-1
Sample input 2
2
Sample output 2
1
Sample input 3
88
Sample output 3
3
It can be expressed as .
Sample input 4
100
Sample output 4
-1
Sample input 5
173553147234869248
Sample output 5
11
It can be expressed as .
input
output
Print the answer on the line.
Example
Input
1
Output
-1
样例
1
-1