spoj#DCEPC202. Unique Paths

Unique Paths

Vaibhav sir and Jyoti ma’am are pretty pissed off after taking the doubt clearing session for first batch. People are not taking them seriously and doing their assignments, so they decided only intelligent students should appear in the tutorials. So they put up a condition, only those students who came to the class walking on unique paths can attend the class. By unique path they meant that at least 1 move differs from any other path. You are at the position (0,0) in the corridor and the class is at the position (n-1,4). Where n is the length of corridor and width is 5 units. You can move only to the adjacent tile on the floor. As you are not idiots you have to reach at the class using shortest path only. Corridor has some broken tiles which are not to be traversed on, they are : (0,2),(n/2,0),(n/2,2)(n/2,4) and (n-1,2). The minimum students required for class is given (k). You have to tell the minimum length of corridor to select k students.

Input

First line contains T (1<=T<=10) number test cases. Each test case consist of 1 integer K (2<=K<=10^18),
minimum number of student required.

Output

Minimum length of corridor required to select at least K student.

Note : Required length of the corridor will always be between 4 and 10000 (inclusive)

Example

Input:
2
2
9

Output: 4
6