#include<iostream>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=1005;
const double eps=1e-8;
int T,n,r,w,top;
struct dian
{
    double x,y;
    dian(double X=0,double Y=0)
    {
        x=X,y=Y;
    }
    dian operator + (const dian a) const
    {
        return dian(x+a.x,y+a.y);
    }
    dian operator - (const dian a) const
    {
        return dian(x-a.x,y-a.y);
    }
}p[N],s[N],d;
int cj(dian a,dian b)
{
    return a.x*b.y-a.y*b.x;
}
double dis(dian a,dian b)
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
bool cmp(const dian &a,const dian &b)
{
    double ar=cj(a-d,b-d);
	return (ar>0)||((ar==0)&&a.x<b.x);
}
int main()
{
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d%d",&n,&r);
        d.x=d.y=10000;top=0;
        for(int i=1;i<=n;i++)
        {
            scanf("%lf%lf",&p[i].x,&p[i].y);
            if(p[i].x<d.x||(p[i].x==d.x&&p[i].y<d.y))
                d=p[i],w=i;
        }//cout<<endl<<d.x<<" "<<d.y<<endl;
        n--;
        for(int i=w;i<=n;i++)
            p[i]=p[i+1];
        sort(p+1,p+1+n,cmp);
        // for(int i=1;i<=n;i++)
            // printf("%f %f\n",p[i].x,p[i].y);
        s[++top]=d,s[++top]=p[1];
        for(int i=2;i<=n;i++)
        {
            while(top>1&&cj(s[top]-p[i],s[top-1]-p[i])>=0)
				top--;
            s[++top]=p[i];
        }
        double ans=2.0*3.1415926*(double)r;//cout<<ans<<endl;
        s[0]=s[top];
        for(int i=1;i<=top;i++)
            ans+=dis(s[i-1],s[i]);//,cout<<s[i].x<<" "<<s[i].y<<endl;
        printf("%.0lf\n",ans);
		if(T)
			puts("");
    }
    return 0;
}