15019 - Crazy Little Thing Called Math   

Description

A palindrome is a number that reads the same from left to right and from right to left.

For example:

121
1331
7

are palindromes, while:

1212
101010
123

are not.


You are given a positive integer N.

If N is not a palindrome, reverse its digits and add the reversed number to the original number.

Then repeat the same process with the new number until a palindrome is reached.

For example, starting with 195:

195 + 591 = 786
786 + 687 = 1473
1473 + 3741 = 5214
5214 + 4125 = 9339


Since 9339 is a palindrome, the process stops.

Your task is to determine how many additions are needed to reach a palindrome and what the final palindrome is.

If the steps needed are more than 100, print Not found. instead

Input

One positive integer:

N

where:

1 ≤ N ≤ 100000

Output

Print two integers separated by a space:

steps palindrome

where:

steps is the number of reverse-and-add operations performed.
palindrome is the final palindrome reached.

If N is already a palindrome, steps is 0.

If the steps are more than 100, print Not found. instead

Sample Input  Download

Sample Output  Download




Discuss