2 shunfurh shunfurh 于 2017.09.12 08:59 提问

Playing with a Calculator

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 3

2个回答

caozhy
caozhy   Ds   Rxr 2017.09.13 00:41
已采纳
shen_wei
shen_wei   Ds   Rxr 2017.09.12 16:00
Csdn user default icon
上传中...
上传图片
插入图片