G

Pythagorean Triangles

Input: Standard Input

Output: Standard Output

 

Many lattice triangles are formed in an (NxN) grid, but not all of them are Pythagorean (Right angled) triangles. Given the value of N your job is to write a program that produces the number of lattice triangles in an (NxN) grid. A lattice triangle is triangle whose three vertices are lattice points. A lattice point in two dimensional Cartesian coordinate system is a point whose abscissa and ordinate are integers.

 

Input

The input file contains at most 15 lines of inputs. Each line contains an integer N (0<N<2001). Input is terminated by a line containing a single zero. This line should not be processed.

 

Output

For each value of N produce one line of output which contains an integer T. Here T denotes the total number of right angled triangles in that (NxN) grid.

 

 

Sample Input                               Output for Sample Input

10

20

30

0

23596

418716

2288304

 


Problem Setter: Shahriar Manzoor

Special Thanks: Derek Kisman