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