#include<iostream>
#include<algorithm>
using namespace std;
int a[105];
int main()
{
int t,i,sum;
cin>>t;
while(t--)
{
sum=0;
int n;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
sum=a[n-1]-a[0];
cout<<sum*2<<endl;
}
return 0;
}