T=int(input()) for t in range(T): P,K=input().split() P=float(P) K=int(K) ans=(1-(1-P)**K)/P print(ans)