1786Playing with a Calculator

1786   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

输入格式:

The input file contains the number K.

Process to the end of file.

输出格式:

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.

输入样例 复制
37
输出样例 复制
1 3

说明

3
3
通过提交
时空限制2000ms/64mb
题目来源
评测方式在线评测
题目类型
难        度