Checkpoint#2821

Checkpoint

1 second
64 megabytes
Easy

You are racing on a 2D lattice grid starting from the origin and moving towards a goal (M, N), where and are positive integers with 0 < M \leq N. There is a checkpoint on the way that does not coincide with either the origin or the goal, located at , where 0 \leq m \leq M and 0 \leq n \leq N. You must pass through the checkpoint before reaching the goal. The length of the shortest path to the goal is T = M + N.

From each point, you can move to one of the four nearest neighboring points at a constant speed. However, since you do not want to lose the race, you will always move right or up at each step.

Although there are many ways to reach the goal while passing through the checkpoint, the race seems trivial since it is always easy to find the shortest route. To make the race more interesting, the rules are changed. Instead of always racing to the same goal (M, N), racers may select the goal and the checkpoint's coordinates so that there are exactly distinct shortest paths from the origin to the goal passing through the checkpoint.

For example, for S = 4, consider two possible placements of the goal and checkpoint:

As a Hacker Cup racer, you need to decide how to place the checkpoint and the goal so you do not lose. Given , find the smallest possible , over all possible placements of the checkpoint and goal, such that there are exactly distinct shortest paths from the origin to the goal passing through the checkpoint.

Input

The first line contains (R \leq 20), the number of races. Then lines follow, each describing a race with a value (1 \leq S \leq 10000000). The lines are separated by the character "\n".

Output

For each race, output on a separate line, as in the example, the race number and the smallest possible length of the shortest path .

Examples

Example 1

Loading
Loading