spoj#TJANDRA2. Tjandra 19th birthday present (HARD)

Tjandra 19th birthday present (HARD)

The 07 February 2013 was Tjandra's 19th birthday, I want to make a present to him and all other great SPOJ solvers by the way. So I set this HARD puzzle problem extension of the yet good TJANDRAS.

Warning : To solve the 'easy' task, you need a O(N^0.5) algorithm, but to solve this 'harder' task, you need something around O(N^0.34), so it's not about optimization tricks!!!
Please note that I checked my data with my 'semi-brute-force'-O(N^0.5)-Python3-solution and it took me 16 hours.

Don't forget to have fun with that problem!

The Game

This game/puzzle is about matches, given N matches, your task is to arrange the matches (not necessarily all) such that the number of rectangles (any size) is maximum.

Input

The input begins with the number T of test cases in a single line.
In each of the next T lines there are one integer N.

Output

For each test case, on a single line, print the required answer (maximum number of rectangles).

Example

Input:
6
3
4
8
12
15
987654321123456789

Output: 0 1 3 9 12 60966316127114768913148159571503206

</p>

Constraints

1 < T ≤ 100
1 < N ≤ 10^18

The T numbers N are uniform-randomly chosen in the range.

Explanations

First test case:
No rectangle can be formed with only 3 matches.

Second test case:
Only one rectangle can be formed with 4 matches.

Third test case:
There are max 3 rectangles.
(2 size 1x1, 1 size 2x1) can be formed with number of matches ≤ 8, here is one of the matches formation:
Case 3 - Fig

Fourth test case:
There are max 9 rectangles.
(4 size 1x1, 2 size 2x1, 2 size 1x2, 1 size 2x2) can be formed with number of matches ≤ 12, here is one of the formation:
Case 4 - Fig

Fifth test case:
there are max 12 rectangles.
(5 size 1x1, 3 size 2x1, 1 size 3x1, 2 size 1x2, 1 size 2x2) can be formed with number of matches ≤ 15, here is one of the formation:
Case 5 - Fig

Sixth test case:
You have to figure by yourself how to compute that in the required time.