High School Programming League 2008/2009

Diophantine equation

Problem code: HS09EQ

Sometimes solving a Diophantine equation is very hard. But, for example, the equation a+b2+c3+d4=n has a trivial solution for every value of n. Your task is to determine the number of solutions of the equation for each given n, assuming that in the equation all the values a, b, c and d are non-negative integers.

Input

The first line of input contains an integer T, representing the number of test cases (T<20000). The following T lines contain one non-negative integer n each, where n < 109.

Output

Output T lines, each containing the number of solutions of the respective equation for n.

Example

Input:
5
0
1
10
100
1000

Output:
1
4
19
148
1476

Scoring

For solving this problem you will score 10 points.


Added by:Robert Gerbicz
Date:2009-09-07
Time limit:1s-4s
Source limit:50000B
Languages:SED C99 strict C++ 4.0.0-8 C++ 4.3.2 TCL SCALA NICE NEM PHP SCM guile LISP sbcl LISP clisp ERL TECS TEXT DOC PDF PS PERL 6 JS
Resource:High School Programming League
SPOJ System © 2010 Sphere Research Labs. All Rights Reserved.