#include<stdio.h>
int n,k;
long len[5001];
long f[5001][1010];
int main() {
int cs,ci;
int i,j; long temp;
scanf("%d",&cs);
for (ci=1; ci<=cs; ci++) {
scanf("%d%d",&k,&n);
k+=8;
for (i=1; i<=n; i++) { scanf("%ld",&len[i]); }
for (i=0; i<=n; i++) {
f[i][0]=0;
for (j=1; j<=k; j++) { f[i][j]=-1; }
}
for (i=n-2; i>=1; i--) {
for (j=1; j<=k; j++) {
f[i][j]=f[i+1][j];
if (f[i+2][j-1]>-1 && n-i+1>=j*3) {
temp=(len[i+1]-len[i])*(len[i+1]-len[i])+f[i+2][j-1];
if (temp<f[i][j] || f[i][j]==-1) f[i][j]=temp;
}
}
}
printf("%ld/n",f[1][k]);
}
return 0;
}