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