#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main(void) {
  int T, N;
  while (scanf("%d", &T) != EOF) {
    if (!T)
      break;
    while (T--) {
      scanf("%d", &N);
      if (N & 1) {
        N--;
        printf("%d\n", N * 2 + 1);
      } else {
        N -= 2;
        printf("%d\n", N * 2 + 2);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%rax
je     11e1 <main+0xc1>
cmpl   $0x0,-0x8(%rbp)
jne    115e <main+0x3e>
jmp    11e1 <main+0xc1>
jmp    1163 <main+0x43>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11dc <main+0xbc>
lea    0xe82(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11b9 <main+0x99>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
add    $0x1,%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
jmp    11d7 <main+0xb7>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
add    $0x2,%esi
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
jmp    1163 <main+0x43>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2ea3(%rip),%r13
cmp    0x0(%r13),%rax
je     11e9 <main+0xc9>
mov    0x8(%rsp),%eax
test   %eax,%eax
je     11e9 <main+0xc9>
lea    0xe9e(%rip),%rbx
lea    0xc(%rsp),%r14
lea    0xe95(%rip),%r15
lea    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%eax
mov    %eax,0x8(%rsp)
jmp    11ac <main+0x8c>
nopl   0x0(%rax)
lea    -0x2(%rax),%ecx
mov    %ecx,0xc(%rsp)
lea    (%rax,%rax,1),%esi
add    $0xfffffffe,%esi
mov    %r15,%rdi
call   1030 <printf@plt>
subl   $0x1,0x8(%rsp)
jb     11d0 <main+0xb0>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   $0x1,%al
je     1190 <main+0x70>
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
lea    (%rax,%rax,1),%esi
add    $0xffffffff,%esi
jmp    119d <main+0x7d>
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmp    0x0(%r13),%rax
je     11e9 <main+0xc9>
mov    0x8(%rsp),%eax
test   %eax,%eax
jne    1180 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %37, %0
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i64, i64* @EOF
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %38
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %8
br label %38
12: ; preds = %8
br label %13
13: ; preds = %36, %12
%14 = load i32, i32* %2
%15 = add nsw i32 %14, -1
store i32 %15, i32* %2
%16 = icmp ne i32 %14, 0
br i1 %16, label %17, label %37
17: ; preds = %13
%18 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = and i32 %19, 1
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %17
%23 = load i32, i32* %3
%24 = add nsw i32 %23, -1
store i32 %24, i32* %3
%25 = load i32, i32* %3
%26 = mul nsw i32 %25, 2
%27 = add nsw i32 %26, 1
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %36
29: ; preds = %17
%30 = load i32, i32* %3
%31 = sub nsw i32 %30, 2
store i32 %31, i32* %3
%32 = load i32, i32* %3
%33 = mul nsw i32 %32, 2
%34 = add nsw i32 %33, 2
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %29, %22
br label %13
37: ; preds = %13
br label %4
38: ; preds = %11, %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i64, i64* @EOF
%7 = icmp ne i64 %5, %6
%8 = load i32, i32* %1
%9 = icmp ne i32 %8, 0
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %18, label %40
11: ; preds = %34
%12 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%13 = load i64, i64* @EOF
%14 = icmp ne i64 %12, %13
%15 = load i32, i32* %1
%16 = icmp ne i32 %15, 0
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %18, label %40
18: ; preds = %0, %11
%19 = phi i32 [ %15, %11 ], [ %8, %0 ]
%20 = add nsw i32 %19, -1
store i32 %20, i32* %1
br label %21
21: ; preds = %18, %34
%22 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%23 = load i32, i32* %2
%24 = and i32 %23, 1
%25 = icmp eq i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %21
%27 = add nsw i32 %23, -1
store i32 %27, i32* %2
%28 = shl nsw i32 %27, 1
%29 = or i32 %28, 1
br label %34
30: ; preds = %21
%31 = add nsw i32 %23, -2
store i32 %31, i32* %2
%32 = shl nsw i32 %31, 1
%33 = add nsw i32 %32, 2
br label %34
34: ; preds = %30, %26
%35 = phi i32 [ %33, %30 ], [ %29, %26 ]
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %1
%38 = add nsw i32 %37, -1
store i32 %38, i32* %1
%39 = icmp eq i32 %37, 0
br i1 %39, label %11, label %21
40: ; preds = %11, %0
ret i32 0
}