#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv)
{
int t,n,xi;
scanf("%d",&t);
for(int i=t;i>0;i--)
{
scanf("%d",&n);
int max=0,min=99;
for(int I=n;I>0;I--)
{
scanf("%d",&xi);
if(xi>max)
{
max=xi;
}
if(xi<min)
{
min=xi;
}
}
printf("%d\n",(max-min)*2);
}
return 0;
}