SUMDEC1 - Sum the Decimal-part I

You are given a number.You need to output the sum of the first 10 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 point (1 in this case) and add the first ten digits after decimal and output them as result

The answer should be (4+1+4+2+1+3+5+6+2+3) = 31.

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 separate lines the result corresponding to integer n.

Constraints

1 < t < 1000
n <= 100000

Example

Input:
2
4
2

Output:
0
31

For a higher difficulty level of this problem, try SUMDEC2.


Added by:Prateek Agarwal
Date:2016-01-10
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY

hide comments
2016-01-10 22:35:16 wisfaq
An easier version can better be put in tutorial rather than classical.

=(Francky)=> Moved ; thanks.

Last edit: 2016-01-11 01:31:14
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.