Limits 2s, 512 MB

See following the two recursive functions:

C(0) = 0
C(1) = 5
C(K) = C(K-1) + 4
F(0) = 1
F(1) = 2
F(N) = F(N-1) + C(N-1)

Now you are given N, you have to find the value of $F(N)$.

Input

Input starts with an integer $T$ ($0 < T \le 1000000$), denoting the number of test cases. Each test case contains an integer $N$ ($0 \le N \le 1000000000$).

Output

For each test case, print the value of $F(N)$. The value of $F(N)$ fits in 64-bit signed integer.

Sample

InputOutput
2
3
5
16
46

This problem was authored for CodeMask Championship 2016 and is being hosted on Toph per organizer’s request.

Submit

Login to submit.

Statistics

85% Solution Ratio
rayhan50001Earliest, May '16
spybitFastest, 0.1s
rayhan50001Lightest, 262 kB
CodingmasterShortest, 115B
Toph uses cookies. By continuing you agree to our Cookie Policy.