Limits 2s, 512 MB

Isn’t mathematics an amazing thing? This whole world can be defined using mathematics. A popular mathematician named Mr.Steve was trying to solve a mathematical problem. He called the Sum of ODD Digits of a number Bad Sum. For example, the Bad Sum of number 1345 is 9. Because ODD Digits in this number are 1,3,5, So 1+3+5=9. He invented another type of Bad Sum. He called the Bad Sum of the divisors of A number Super Bad Sum. Now Mr. Steve is a very bad programmer, that’s why he told you to write a programme which will find the Super Bad Sum of a Number N.

See Sample I/O and explanation for better understanding.

Input

The first line of the input contains one integer T(≤10^6), representing the number of test cases. Next T line contains one integer each representing N(1≤ N ≤ 10^6).

Output

For each test case print one single integer representing Super Bad Sum of N.

Sample

InputOutput
3
10
23 
1001
7
4
44

Explanation of Sample Case 1
Divisors of 10 are 1,2,5,10

Bad Sum(1) = 1
Bad Sum(2) = 0
Bad Sum(5) = 5
Bad Sum(10) = 1

So Superbadsum(10)= Bad Sum(1) + Bad Sum(2) + Bad Sum(5) + Bad Sum(10) = 1+0+5+1 = 7

Submit

Login to submit.

Statistics

77% Solution Ratio
RenegadesEarliest, Jan '18
mumith_fahim99Fastest, 0.4s
kaium.Lightest, 3.1 MB
Fazlerabbi.Shortest, 552B
Toph uses cookies. By continuing you agree to our Cookie Policy.