import math as m I=input for t in [0]*int(I()): N,X=I().split() X=float(X) c=m.acos(-X/m.sqrt(X*X+1)) print(m.sin(int(N)*c+c)/m.sin(c))