#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

int gcd(int a, int b){
	return b ? gcd(b, a%b) : a;
}

int n, a, b, c, p[20], ans, v[20];

int gao(){
	int ret = 0;
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			int x = abs(v[i]-v[j]);
			ret += p[i]*p[j]*(a*x*x+b*x+c);
		}
	}
	return ret;
}

void dfs(int k, int l, int r){
	if(k == n){
		ans = min(ans, gao());
		return ;
	}
	if(l >= 0){
		v[k] = l;
		dfs(k+1, l-1, r);
	}
	if(r < n){
		v[k] = r;
		dfs(k+1, l, r+1);
	}
}

int main(){
	int T;
	scanf("%d", &T);
	while(T--){
		scanf("%d%d%d%d", &n, &a, &b, &c);
		for(int i=0;i<n;++i) scanf("%d", p+i);
		sort(p,p+n);
		reverse(p,p+n);
		ans = 0x7fffffff;
		v[0] = n/2;
		dfs(1, v[0]-1, v[0]+1);
		int g = gcd(ans, 10000);
		printf("%d/%d\n", ans/g, 10000/g);
	}
}
