from decimal import getcontext,Decimal import sys input=sys.stdin.readline write=sys.stdout.write getcontext().prec=30 T=int(input()) X=[0]*T for case in range(T): p,K=map(Decimal,input().split()) if p>0: X[case]=(1-pow(1-p,K))/p else: X[case]=K write("\n".join(map(str,X)))