Kevin and Expected Value  2
Difficulty: Hard

When students solved the first problem quickly, Kevinsogo gave them a harder problem. Students need your help in solving this problem.<br>

Given the value of $N$ and a function $\scriptsize {\text{rand}()} $ which uniformly produces an integer value between $0$ and $N-1$, let's define
$$
\scriptsize{
f(N) = \sqrt{1 + \text{rand}() + { \sqrt{ 1 + \text{rand}() + { \sqrt { 1 + \text{rand}() + \sqrt { 1 + \text{rand}() + \cdots }}}} }}
}$$

Find out the expected value of $f(N)$.

**Input Format**  
The first line contains an integer $T$ i.e. the number of test cases.<br>
Next $T$ lines contain an integer $N$.<br>

**Output Format**  
Print output corresponding to each test case in seperate line correct to 5 decimal place.

**Constraints**  

$ 1\le T \le 100$  
$ 1\le N \le 10^{4}$  

OR

$ 1\le T \le 10$  
$ 1\le N \le 5 \times 10^{5}$  


**Sample Input**

    3
    1
    5
    10


**Sample Output**

	1.61803398875
    2.27532378545
    2.8422345835


**Explanation**

For the $N=1$, $F(N)$ can have only one value i.e. $\sqrt{1 +   { \sqrt{ 1 +  { \sqrt { 1 +  \sqrt { 1 +  \cdots }}}} }}$ which will be $1.61803398875$.


Input Format:

Output Format:

Sample Input:

Sample Output:

Python 3 starter code:


Reference solution (C++):
	#include <math.h>
	#include <stdio.h>

	int n,i,T;
	double l,r,c,ans;

	int main()
	{
		scanf("%d",&T);
		while(T--)
		{
			scanf("%d",&n);
			l=0;
			r=n*2;
			while(r-l>1e-6)
			{
				c=(l+r)/2;
				ans=0;
				for(i=1;i<=n;i++)
					ans+=c-sqrt(i+c);
				if(ans>0)
					r=c;
				else
					l=c;
			}
			printf("%.5lf\n",l);
		}
		return 0;
	}