N=int(input()) for i in range(N): p,K=map(float,input().split()) print((1-(1-p)**K)/p if p!=0 else K)