#include <iostream> #include <iomanip> #include <algorithm> #include <cstdio> #include <cstring> using namespace std; typedef pair<double, double> P; const int N = 100; const int HS = N * 11; int n, k, x, y, t; double p[50]; P mat[N][HS * 2]; bool isset[N][HS * 2]; P solve( int idx, int score ) { if( idx == n ) { P result( score > 0 ? 1.0 : 0.0, 0 ); return result; } else if( !isset[idx][score + HS] ) { isset[idx][score + HS] = true; P result( 0.0, 0.0 ); P correct = solve( idx + 1, score + y ); P wrong = solve( idx + 1, score - x ); result.first += (correct.first + (k - 1) * wrong.first) / k; result.second += ( y + correct.second + (k - 1) * (wrong.second - x) ) / k; mat[idx][score + HS] = result; } return mat[idx][score + HS]; } int main() { freopen("quiz.in", "r", stdin); freopen("quiz.out", "w", stdout); int cl = clock(); for( cin >> t; t--; ) { cin >> n >> k >> x >> y; for( int i = 0; i < k; i ++ ) cin >> p[i]; memset( isset, 0, sizeof isset ); P result = solve(0, 0); cout.precision(5); cout.setf( ios::fixed | ios::showpoint ); cout << result.first << " " << result.second / y << endl; } cerr << (clock() - cl) * 1. / CLOCKS_PER_SEC << endl; return 0; }