#include using namespace std; int main(){ int t; cin >> t; cout << fixed << setprecision(11); while(t--){ double p; int k; cin >> p >> k; if(p>0){ //公比数列の和:1+(1-p)+(1-p)^2+...+(1-p)^(k-1) double r=1-p; cout << (1-pow(r,k))/p << endl; }else{ cout << k << endl; } } }