#include "bits/stdc++.h"
using namespace std;
vector <double> x, y;
vector <double> si, co;
double d;
const int N = 2500;
const double h = 2 * acos(-1.0) / N;
double getF(int j) {
double minX = 1e9, maxX = -1e9;
for (int i = 0; i < (int)x.size(); ++i) {
double xx = x[i] * co[j] + y[i] * si[j];
minX = min(minX, xx);
maxX = max(maxX, xx);
}
return min(d, maxX - minX);
}
double get() {
double sum = 0;
for (int i = 0; i <= N; ++i) {
sum += getF(i) * ((i==0 || i==N) ? 1 : ((i&1)==0) ? 2 : 4);
}
sum /= 3 * N;
sum /= d;
return sum;
}
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#else
#endif
co.resize(N + 1);
si.resize(N + 1);
for (int i = 0; i <= N; ++i) {
co[i] = cos(i * h);
si[i] = sin(i * h);
}
int t;
cin >> t;
cout << setprecision(10) << fixed;
while (t--) {
int n;
scanf("%d%lf", &n, &d);
x.resize(n);
y.resize(n);
for (int i = 0; i < n; ++i) {
scanf("%lf%lf", &x[i], &y[i]);
}
cout << get() << "\n";
}
return 0;
};
I2luY2x1ZGUgImJpdHMvc3RkYysrLmgiCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdmVjdG9yIDxkb3VibGU+IHgsIHk7CnZlY3RvciA8ZG91YmxlPiBzaSwgY287Cgpkb3VibGUgZDsKCmNvbnN0IGludCBOID0gMjUwMDsKY29uc3QgZG91YmxlIGggPSAyICogYWNvcygtMS4wKSAvIE47Cgpkb3VibGUgZ2V0RihpbnQgaikgewogICAgZG91YmxlIG1pblggPSAxZTksIG1heFggPSAtMWU5OwoKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgKGludCl4LnNpemUoKTsgKytpKSB7CiAgICAgICAgZG91YmxlIHh4ID0geFtpXSAqIGNvW2pdICsgeVtpXSAqIHNpW2pdOwogICAgICAgIG1pblggPSBtaW4obWluWCwgeHgpOwogICAgICAgIG1heFggPSBtYXgobWF4WCwgeHgpOwogICAgfQogICAgcmV0dXJuIG1pbihkLCBtYXhYIC0gbWluWCk7Cn0KCgoKZG91YmxlIGdldCgpIHsKICAgIGRvdWJsZSBzdW0gPSAwOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPD0gTjsgKytpKSB7CiAgICAgICAgc3VtICs9IGdldEYoaSkgKiAoKGk9PTAgfHwgaT09TikgPyAxIDogKChpJjEpPT0wKSA/IDIgOiA0KTsKICAgIH0KICAgIHN1bSAvPSAzICogTjsKICAgIHN1bSAvPSBkOwogICAgcmV0dXJuIHN1bTsKfQoKCmludCBtYWluKCkgewojaWZkZWYgTE9DQUwKICAgIGZyZW9wZW4oImlucHV0LnR4dCIsICJyIiwgc3RkaW4pOwogICAgLy9mcmVvcGVuKCJvdXRwdXQudHh0IiwgInciLCBzdGRvdXQpOwojZWxzZQoKI2VuZGlmCgogICAgY28ucmVzaXplKE4gKyAxKTsKICAgIHNpLnJlc2l6ZShOICsgMSk7CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPD0gTjsgKytpKSB7CiAgICAgICAgY29baV0gPSBjb3MoaSAqIGgpOwogICAgICAgIHNpW2ldID0gc2luKGkgKiBoKTsKICAgIH0KCiAgICBpbnQgdDsKICAgIGNpbiA+PiB0OwoKICAgIGNvdXQgPDwgc2V0cHJlY2lzaW9uKDEwKSA8PCBmaXhlZDsKCiAgICB3aGlsZSAodC0tKSB7CiAgICAgICAgaW50IG47CiAgICAgICAgc2NhbmYoIiVkJWxmIiwgJm4sICZkKTsKCiAgICAgICAgeC5yZXNpemUobik7CiAgICAgICAgeS5yZXNpemUobik7CgogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7CiAgICAgICAgICAgIHNjYW5mKCIlbGYlbGYiLCAmeFtpXSwgJnlbaV0pOwogICAgICAgIH0KICAgICAgICBjb3V0IDw8IGdldCgpIDw8ICJcbiI7CiAgICB9CgogICAgcmV0dXJuIDA7Cn07