Click here to read problem statement
Input: There is a single positive integer T on the first line of input (equal to about 100000). It stands for the number of numbers to follow. Then there are T lines, each containing exactly one positive integer number N, 1≤N≤109.
Output: For every number N, output a single line containing the single non-negative integer Z(N).
Sample Input:
6
3
60
100
1024
23456
8735373
Sample Output:
0
14
24
253
5861
2183837
Solution To check the approach Visit here