NICE SQUARES
A 10-digit number is called nice if the difference between the first
5 digits and the last 5 digits is at most 40 (i.e., a 10-digit number
ABCDEFGHIJ is nice if -40 <= ABCDE - FGHIJ <= 40). For example,
4520745189 is nice (since 45267 - 45189 = 18) and 6352763535 is nice
(since 63527 - 63535 = -8). A 10-digit number is called a nice square
if it is a nice number and it is a perfect square.
Given a positive integer n, 1000000000 <= n <= 9000000000, you must
find the next number after n that is a nice square.
(Note: there is a time limit of about 1 minute to run your programme.)
INPUT
-----
The input will consist of at most 100 test cases. Each n will appear
on a separate line.
The end of the input will be indicated by an input value of n=0.
(Do not produce output for this case.)
OUTPUT
------
For each n, output the smallest nice square that is bigger than n.
Each output value should appear on a line by itself.
SAMPLE INPUT
------------
1000000000
7625182612
8264082649
9000000000
0
SAMPLE OUTPUT
-------------
1057810576
8264082649
8459584576
9044390404