//this is working fine with the custom inputs given in the question.
//but show wrong result while submission.
#include<bits/stdc++.h>
using namespace std;
int main()
{ int T;
long int N,a,b,c;
long int i=0;
long int ar[100000];
cin>>T;
while(T–)
{i=0;
cin>>N>>a>>b>>c;
long int n=N;
while(N–)
{
cin>>ar[i++];
}
long int t;
if(a<b)
{
sort(ar,ar+n);
t= abs(b-ar[0])+c+abs(ar[0]-a);
}
else if(a>b)
{ std::sort(std::begin(ar), std::end(ar), std::greater<>());
t= abs(ar[0]-b)+c+abs(a-ar[0]);
}
cout<<t<<"\n";
}
return 0;
}