Equation Problem

Time Limit
1s
Memory Limit
32768KB
Judge Program
Standard
Ratio(Solve/Submit)
13.64%(3/22)
Description:

Captain Huang has found an amazing equation.For some integers n, there exists an positive integer m for which 2m(m + 1) =n(n + 1). The integer n is named as “Amazing Number”. Now, Captain Huang will tell you an integer L, please answer the smallest Amazing Number which is no smaller than L.

Input:

The first line is an integer T which represents the number of cases (1<=T<1000).

The following T lines, each line contains an integer L (1<=L<10^190).

Output:

For each given L, output the smallest Amazing Number n. If available n does not exist, output -1.

Sample Input:
3
1
4
21
Sample Output:
3
20
119

Submit