Олимпиадный тренинг

Задача 38953. Ordinal numbers


Задача

Темы:
Misha has a developed aesthetic sense. He believes that not all numbers are equally decent. When he is sad, he starts making up numbers and putting them in order.

Misha loves to consider the sum of the digits of a number. In order to put the number A in order, he first writes down the number itself. Then he writes the sum of the digits of this number. Then — the sum of the digits the sum of the digits, and so on, until the next number is single digit. He believes that the result of putting the number A in order is the sum of all the numbers written out, including the number A itself.

Misha loves this process so much that he even replaces the count of sheep for him when he can’t fall asleep for a long time. He remembers that last night, when he put the number A in order in his mind, he got the number B. But the trouble is — he does not remember which number A he took! Help him find this number.

Input
The input is a single integer B (1 ≤ B ≤ 109 )

Imprint
If there is such a number A that after putting it in order, it turns out B, then print any such number. If Misha made a mistake in his calculations somewhere and such a number doesn't exist, print -1.

 
Examples
# Input Output
1 42 29
2 20 -1