spoj#SUMDEC2. Sum the Decimal-part II

Sum the Decimal-part II

A much easier version of this problem can be found here-SUMDEC1.
In case you haven't tried it out,try the first part.

In this problem,You are given a number.You need to output the sum of the first 1000 decimal places of the square-root of the number(Ignore the Integral part).

For example-if the given number is 2. The square-root of 2 is 1.4142135623.....
So,ignore the number before decimal (1 in this case) and add the first 1000 digits after decimal and output them as result-4482.(in this case)

NOTE-If the number is a perfect square,the output should be 0.

Input

the first line of input consist of t (the number of test cases).
t lines follow-Each line consist of a non-negative integer n.

Output

Output in seperate lines the result corresponding to integer n.

Constraints

1<=t<=100
1<=n<=100000

Example

Input:
2
4
2

Output:
0
4482