URI Online Judge | 1612

Little Ant

By Bruno Adami, Universidade de São Paulo - São Carlos BR Brazil

Timelimit: 1

A little ant is walking on the top of a tree trunk of length N meters. We can consider that the ant may assume the positions from 0 to N-1. Assume that it is on the X axis of the coordinate plane, but it starts in an unknown position. The only thing known about the ants initial position is that its value is an integer number.

The little ant may take a step to the right or to the left, and this step will make it move one meter. If the ant is at position Pand moves to the right, it will assume the position P+1. If the step is to the left, it will assume the position P-1. If in any moment it assumes the position -1 or N, the ant will fall off the tree trunk! A step takes one second to be completed, and the ant is always moving.

Considering that the ant will always choose the worst sequence of movements, you must choose an initial position that maximizes the time that the ant will stay on the top of the trunk. Output that time.


The first line contains an integer T (T <= 100) indicating the number of test cases.

For each test case we will have a single line with the integer N (1 ≤ N ≤ 109) indicating the size of the tree trunk.


For each case, output the maximum amount of time the little ant can be on the trunk.

Sample Input Sample Output