#include using namespace std; const int MaxN = (int)1e5 + 10; const int MOD = (int)1e9 + 7; const int INF = 1e9; int n, a, b; int x[MaxN]; void solve() { scanf("%d%d%d", &n, &a, &b); assert (1 <= n && n <= 1e4); int aa = 0, bb = 0; for (int i = 1; i <= n; ++i) { scanf("%d", &x[i]); assert (1 <= x[i] && x[i] <= n); if (x[i] == a) { aa++; } if (x[i] == b) { bb++; } } long long num = 1LL * aa * bb; long long den = 1LL * n * n; cout.precision(10); cout << fixed << 1.0 * num / den << "\n"; } int main() { // freopen("input.txt", "r", stdin); // ios::sync_with_stdio(false); cin.tie(NULL); int t; scanf("%d", &t); assert (1 <= t && t <= 70); while (t --> 0) { solve(); } return 0; }