Codeforces Round 122 (Div. 2)
B
Square
Codeforces
1200
原题
← AC →
翻译中…

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?

翻译中…

image 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

翻译中…

The first line contains integer $*t*$ ($1 ≤ *t* ≤ 10^{4}$) — the number of test cases.

翻译中…

The second line contains $*t*$ space-separated integers $*n*_{*i*}$ ($1 ≤ *n*_{*i*} ≤ 10^{9}$) — the sides of the square for each test sample.

翻译中…

Output

翻译中…

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.

翻译中…

样例

Input #1
3
4 8 100
Output #1
17
33
401
InputCopy OutputCopy
题目信息
题号
194B
时间限制
2 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。