Under construction

Still being built. Things may change

Squares in a grid square

Time limit2sMemory limit512 MB

Summary
For each grid side length l, count every square whose sides lie along grid lines, including tilted ones.
Level

Easy3 of 10

Topics
Math, Combinatorics, Implementation
Solved
No attempts yet

Problem

The game "La cave aux énigmes" asks how many squares are contained in a grid square whose side has length ll. A grid square of side length 4 looks like this.

Thirty squares are visible in that picture. Count every square visible in the picture of a grid square of side length ll.

Input

The first line contains the number of test cases PP. (1≤P≤10001 \le P \le 1000)

Each of the next PP lines contains one side length ll of a grid square. (1≤l≤9999991 \le l \le 999999)

Output

For each ll, print the number of squares visible in the picture of a grid square of side length ll, one per line. The answer can exceed the range of a 32-bit integer, so use 64-bit integers.

Examples1

  1. Example 1

    Input
    4
    1
    2
    3
    4
    
    Expected output
    1
    5
    14
    30