#include #define rep(i, a) for (int i = 0; i < (a); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define repr(i, a) for (int i = (a) - 1; i >= 0; i--) #define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--) using namespace std; typedef long long ll; const ll inf = 1e9; const ll mod = 1e9 + 7; struct XorShift { unsigned z; XorShift() : z((unsigned)time(NULL)) {} XorShift(int seed) : z(z) {} unsigned next() { z ^= z << 13; z ^= z >> 17; z ^= z << 5; return z; } unsigned nextInt(unsigned a, unsigned b) { return next() % (b - a + 1) + a; } double nextDouble() { return next() / (double)(1ll << 32); } }; bool usedA[10], usedB[10]; int main() { int N; double PA, PB; cin >> N >> PA >> PB; vector A(N), B(N); rep (i, N) cin >> A[i]; rep (i, N) cin >> B[i]; sort(A.begin(), A.end()); sort(B.begin(), B.end()); int winA = 0; int winB = 0; XorShift random; const int C = 2e5; rep (ii, C) { int a = 0; int b = 0; vector X(A), Y(B); rep (i, N) { int ia, ib; if (i == N - 1 || random.nextDouble() <= PA) { ia = 0; } else { ia = random.nextInt(1, X.size() - 1); } if (i == N - 1 || random.nextDouble() <= PB) { ib = 0; } else { ib = random.nextInt(1, Y.size() - 1); } if (X[ia] > Y[ib]) { a += X[ia] + Y[ib]; } else { b += X[ia] + Y[ib]; } X.erase(X.begin() + ia); Y.erase(Y.begin() + ib); } if (a > b) winA++; if (a < b) winB++; } double ans = (double)winA / C; printf("%.20f\n", ans); }