Felipe and the Sequence

On February 19, 2017, Red Matemática proposed the following mathematical challenge on its twitter account (@redmatematicant): “Felipe, how many terms of the next sequence of numbers must be added to make the result equal to 200?” √ 1√ +√ 1√ +√ 1√ +√ 1√ +···=200 1+2 2+3 3+4 4+5 Using this interesting puzzle as our starting point, the problem you are asked to solve now is: Given a positive integer S (1 ≤ S ≤ 109) representing the result obtained for the sum of the terms in the sequence, find out the number n that represents the total number of terms in the sequence to sum up. 11111 √ √+√ √+√ √+√ √+···+√ √ =S 1+2 2+3 3+4 4+5 n+n+1 Input Input begins with an integer t (1 ≤ t ≤ 5∗105), the number of test cases, followed by t lines, each containing an integer S (1 ≤ S ≤ 109). Output For each test case, your program must print one positive integer denoting the number n that represents the total number of terms in the sequence to sum up. Sample Input 1 200 Sample Output 40400