KMOVES - Knight Moves

A knight is located at the (black) origin of an infinite chessboard. Let f(n) define the number of black squares the knight can reach after making exactly n moves. Given n (0 <= n <= 108), output f(n).

Input

The first line of the input contains a single integer T, the number of test cases (1 <= T <= 106). Each test case consists of a single positive integer n.

Output

For each value of n in the input, print a single line containing.

Example

Input:
2
0
1

Output:
1
0

Added by:Amlesh Jayakumar
Date:2009-12-16
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 PERL6
Resource:Own

hide comments
2022-08-17 14:52:15
When n is 2, the answer is 33.
2022-08-17 13:13:42
Is the answer is 32 when n is 2?
2018-10-12 09:00:05
not easy but did it. ^ __ ^
2017-05-13 12:44:01 amit_gh
For some reason my Java solution was giving wrong answer. Same algorithm got accepted in python. Got 3 WAs due to that.
2017-02-22 07:19:41 darryl
cool
2014-02-17 06:05:49 anurag garg
easy

Last edit: 2014-02-17 06:06:24
2013-11-21 06:40:41 Amlesh Jayakumar
Explanation of sample output:
In 0 moves, the knight can reach 1 black square (namely the square it starts on). In 1 move it can't reach any black squares, since any knight move from a black square leads to a white square, hence the output 0.
2012-12-25 16:36:29 Goldie
Please can someone explain the output.
Not getting clear picture what is required be done here.
2012-07-13 20:28:21 (Tjandra Satria Gunawan)(曾毅昆)
This is Fun :)
2012-07-13 16:58:21 Mostafa 36a2
I See ... I See -_-
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.