P15669 [CodeChef] VK18
提高-
题目描述

Read problems statements in Mandarin chinese, Russian and Vietnamese as well.

Chef is so good at programming that he won almost all competitions. With all the prizes, Chef bought a new house. The house looks like a grid of size N (1-indexed) which consists of N × N rooms containing diamonds. For each room, the room number is equal to the sum of the row number and the column number.
The number of diamonds present in each room is equal to the absolute difference between the sum of even digits and sum of odd digits in its room number. For example, if the room number is 3216, then the number of diamonds present in that room will be |(2+6)-(3+1)| = 4.
You are given the number N. You have to print the total number of diamonds present in Chef's house.

------ Input ------

The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
The only line of each test case contains a single integer N.

------ Output ------

For each test case, print the answer on a separate line.

------ Constraints ------

$1 ≤ T ≤ 10^{5}$
$1 ≤ N ≤ 10^{6}$

------ Subtasks ------

Subtask #1 (15 points):

$1 ≤ T ≤ 10$
$1 ≤ N ≤ 1000$

Subtask #2 (15 points):

$1 ≤ T ≤ 10$
$1 ≤ N ≤ 10^{6}$

Subtask #3 (70 points): original constraints

----- Sample Input 1 ------
3
1
2
3
----- Sample Output 1 ------
2
12
36
----- explanation 1 ------
Example case 3: There are 9 rooms. Room (1,1) has number 2, room (1,2) has number 3, etc. For each room, the number of diamonds in it is equal to the room number, so the total number of diamonds present is (2+3+4+3+4+5+4+5+6) = 36.

输入格式

见题面

输出格式

见题面

样例输入
3 1 2 3
样例输出
2 12 36