#include using namespace std; typedef long long int ll; typedef unsigned long long ull; typedef long double ld; int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 }; const long long mod = 998244353; const ll inf = 1LL << 60; const int INF = 5e8; void solve() { int k; ld p; cin >> p >> k; vector dp(k + 1); for (int i = k - 1; i >= 0; i--) { dp[i] = (1 - p) * (dp[i + 1] + 1) + p; } printf("%.18Lf", dp[0]); } int main() { int t; cin >> t; while (t--) solve(); }