#include using namespace std; #define all(v) (v).begin(),(v).end() #define pb(a) push_back(a) #define rep(i, n) for(int i=0;i> p >> k; long double a = 1; long double ans = 0; for(int i = 1; i < k; i ++) { ans += a * p * (long double) i; a *= (long double)1 - p; } ans += a * (long double) k; dout(ans); } int main() { cin.tie(0); ios::sync_with_stdio(false); int t; cin >> t; while(t --) solve(); return 0; }