# import pypyjit # pypyjit.set_param('max_unroll_recursion=-1') from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline x = 1/(math.e*math.pi*math.pi) def g(t,N): return math.exp(math.cos(t/N)) def f(N): S = g(0,N)+g(x,N) for i in range(1,64): S += g(x*i/64,N)*2 return x*S/128 for _ in range(int(input())): print(f(int(input())))