#include <bits/stdc++.h>
#define maxn 100010
#define eps 1e-7
using namespace std;
const double pi = acos(-1);
int n, L;
struct node {
double x, y;
node () {}
node(double a, double b) : x(a), y(b) {}
bool operator < (const node &a) const {
if (x != a.x) return x < a.x;
return y < a.y;
}
node operator - (const node &a) const {
return node(x - a.x, y - a.y);
}
} p[maxn], ps[maxn], p2[maxn];
int cmp(double x) {
if (fabs(x) < eps) return 0;
return x > 0 ? 1 : -1;
}
double dis(node a, node b) {
return sqrt(abs(a.x - b.x) * abs(a.x - b.x) + abs(a.y - b.y) * abs(a.y - b.y));
}
double cp(node a, node b) {
return a.x * b.y - a.y * b.x;
}
int andrew() {
sort(p + 1, p + 1 + n);
int len = 0;
for (int i = 1; i <= n; i++) {
while (len > 1 && cmp(cp(ps[len] - ps[len - 1], p[i] - ps[len - 1])) < 0)
len--;
ps[++len] = p[i];
}
int k = len;
for (int i = n - 1; i >= 1; i--) {
while (len > k && cmp(cp(ps[len] - ps[len - 1], p[i] - ps[len - 1])) < 0)
len--;
ps[++len] = p[i];
}
return len;
}
double ans;
int t;
char ch;
int main() {
ios::sync_with_stdio(false);
scanf("%d", &t);
while (t--) {
ans = 0;
scanf("%d %d", &n, &L);
for (int i = 1; i <= n; i++)
cin >> p[i].x >> p[i].y;
int tmp = andrew();
for (int i = 1; i < tmp - 1; i++)
ans += dis(ps[i], ps[i + 1]);
ans += dis(ps[1], ps[tmp - 1]);
ans += 2.0 * pi * L;
if(t) printf("%.0lf\n\n", ans);
else printf("%.0lf\n",ans);
}
return 0;
}