Number#2394

Number

1 second
64 megabytes
Medium

Find the largest natural number which does not exceed a given and whose decimal representation coincides with the last digits of its square.

Input

A natural number (1 \leq M \leq 1\,000\,000\,000).

Output

The answer to the problem.

Examples

Example 1

Loading
Loading