T = int(input()) def force_int(x): x = float(x) return x if x%1 else int(x) for _ in range(T): p, K = map(force_int, input().split()) ans = 0 for i in range(K): ans += (1-p)**i print(ans)