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