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