#入力形式チェック import math as m I=input for t in [0]*int(I()): N,X=I().split() if len(X)==7: assert(X[:2]=="0.") else: assert(len(X)==8) assert(X[:3]=="-0.") assert("00000"<=X[-5:]<="99999") X=float(X) c=m.acos(-X/m.sqrt(X*X+1)) print(m.sin(int(N)*c+c)/m.sin(c))