Find the largest natural number which does not exceed a given M and whose decimal representation coincides with the last digits of its square.
A natural number M (1 \leq M \leq 1\,000\,000\,000).
The answer to the problem.
Example 1