#include using namespace std; #ifdef LOCAL #include "debug.hpp" #else #define debug(...) 1 #endif void solve() { long double p; int k; cin >> p >> k; if (p == 0) { cout << k << '\n'; } else { long double c = 1; for (int i = 0; i < k; i++) { c *= (1 - p); } long double ans = (1 - c) / p; cout << fixed << setprecision(15) << ans << '\n'; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { solve(); } }