#include using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { double p; int k; cin >> p >> k; double ans = 0; double tmp = 1; for (int j = 1; j < k; j++) { ans += j * tmp * p; tmp *= (1 - p); } ans += tmp * k; cout << fixed << setprecision(15); cout << ans << endl; } }