Four Square

4.5

4 votes
Mathematics, Open, Approved, Easy, Number Theory
Problem

Rahul has recently been obsessed with mathematics, and spends most of his time reading the research notes of his equally eccentric math professor. On one of the pages of the research notes, Rahul finds a scribble that says, " the number of ways to represent a number as sum of four squares would be the ultimate answer to Life, the Universe and Everything", now since he doesn't have enough time to calculate this for all the numbers, he asks your help.
Given a number N, your task is to print the number of ways it can be represented as sum of four squares.

Input:
First line contains number of test cases T. Next T lines contains a single number N.

Output:
For each test case print number of ways a given N can be represented as the sum of four squares

Constraints:
1<=T<=1000
1<=N<=1010

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

Example for n=1 there are eight ways to represent one as sum of four squares
1^2 + 0^2 + 0^2 + 0^2
0^2 + 1^2 + 0^2 + 0^2
0^2 + 0^2 +1^2 + 0^2
0^2 + 0^2 +0^2 + 1^2
(-1)^2 + 0^2 + 0^2 + 0^2
0^2 + (-1)^2 + 0^2 + 0^2
0^2 + 0^2 + (-1)^2 + 0^2 0^2 + 0^2 + 0^2 + (-1)^2

Editor Image

?