Playing with a Calculator
Time Limit: 1 Second Memory Limit: 32768 KB
Pete is playing a game. He types on a calculator a natural number K and then
presses the '+' key. The display still shows K. Pete wants to have on the display
a number that is formed using only one figure. In order to get that he presses,
if it is necessary, the '=' key several times (maybe 0). The result after the
first pressing is K+K. After each pressing the number K is added to the sum.
Find out whether Pete will achieve his goal or not, and what number, consisting
all of identical figures, he will get first. Consider the capacity of the calculator
to be unlimited.
K < 1000
Input
The input file contains the number K.
Process to the end of file.
Output
The output file must contain two numbers: first the figure that forms the result and then the number of digits of the result. If multiple solution exists, first minimize the figure then minimize the number of digits. If finding the desired result is impossible, the output file must contain only one number -1 (minus 1). The numbers in the output file must be separated by one space.
Sample Input
37
Sample Output
1 3Submit