Problem B

Statement
Copy Copied
Description:
There is a square painted on a piece of paper, the square's side equals n meters. John Doe draws crosses on the square's perimeter. John paints the first cross in the lower left corner of the square. Then John moves along the square's perimeter in the clockwise direction (first upwards, then to the right, then downwards, then to the left and so on). Every time he walks (n + 1) meters, he draws a cross (see picture for clarifications).

John Doe stops only when the lower left corner of the square has two crosses. How many crosses will John draw?

The figure shows the order in which John draws crosses for a square with side 4. The lower left square has two crosses. Overall John paints 17 crosses.

Input Format:
The first line contains integer t (1 ≤ t ≤ 104) — the number of test cases.

The second line contains t space-separated integers ni (1 ≤ ni ≤ 109) — the sides of the square for each test sample.

Output Format:
For each test sample print on a single line the answer to it, that is, the number of crosses John will draw as he will move along the square of the corresponding size. Print the answers to the samples in the order in which the samples are given in the input.

Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

Note:
None

Evaluations

Eval IDRun IDProviderModelLangSuccessTimestampPromptResponseStdoutStderrRetry
3193 20260320-230005 gemini gemini-3-pro-preview go true 2026-03-20T23:07:34.164824Z View View View View Retry
2119 20260311-031437 gemini gemini-3-pro-preview go true 2026-03-11T03:16:45.53617Z View View View View Retry