#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main(){ int t, k; cin >> t; for (int i = 0; i < t; i++){ double p, sum1 = 0, r = 1; cin >> p >> k; for (int j = 0; j < (k-1); j++){ sum1 += (j+1)*p*r; r *= (1 -p); } cout << fixed << setprecision(6) << sum1 + k*r << endl; } }