#include using namespace std; const int MAX = 200; int main(){ cout << fixed << setprecision(20); vector fact(MAX + 1); fact[0] = 1; for (int i = 1; i <= MAX; i++){ fact[i] = fact[i - 1] * i; } auto get = [&](int n, int k){ if ((n + k) % 2 == 1){ return (long double) 0; } long double a = fact[n + 1] / fact[k] / fact[n + 1 - k]; if ((n + k) % 4 == 2){ a *= -1; } return a; }; int T; cin >> T; for (int i = 0; i < T; i++){ int N; long double x; cin >> N >> x; long double s = 0; for (int j = N; j >= 0; j--){ s = s * x + get(N, j); } s *= pow(x * x + 1, -(long double) N / 2); cout << s << endl; } }