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