import std.conv, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex, std.typecons; import core.bitop; class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { if (stdin.eof) throw new EOFException; tokens = readln.split; } auto token = tokens[0]; tokens.popFront; return token; } int readInt() { return readToken().to!int; } long readLong() { return readToken().to!long; } real readReal() { return readToken().to!real; } void chmin(T)(ref T t, in T f) { if (t > f) t = f; } void chmax(T)(ref T t, in T f) { if (t < f) t = f; } int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = cast(int)(as.length); for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; } int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a < val)); } int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a <= val)); } class XRand { uint x = 314159265, y = 358979323, z = 846264338, w = 327950288; void setSeed(uint seed) { w ^= seed * 65535; } uint next() { uint t = x ^ x << 11; x = y; y = z; z = w; return w = w ^ w >> 19 ^ t ^ t >> 8; } uint nextInt(uint m) { return next() % m; } int nextInt(int a, int b) { return a + nextInt(b - a + 1); } real nextReal() { return next() / 4294967296.0; } } immutable NUM_TRIES = 2 * 10^^5; int N; real[] P; int[][] A; void main() { try { for (; ; ) { N = readInt(); P = new real[2]; foreach (h; 0 .. 2) { P[h] = readReal(); } A = new int[][](2, N); foreach (h; 0 .. 2) { foreach (i; 0 .. N) { A[h][i] = readInt(); } A[h].sort; } auto seq = new int[][1 << N]; foreach (s; 0 .. 1 << N) { foreach (i; 0 .. N) { if ((s >> i) & 1) { seq[s] ~= i; } } } auto rng = new XRand(); real nmr = 0.0; foreach (_; 0 .. NUM_TRIES) { int score; auto s = new int[2]; s[] = (1 << N) - 1; foreach (k; 0 .. N) { const pop = N - k; auto a = new int[2]; foreach (h; 0 .. 2) { const pos = (pop == 1) ? 0 : (rng.nextReal() < P[h]) ? 0 : rng.nextInt(1, pop - 1); const i = seq[s[h]][pos]; s[h] ^= 1 << i; a[h] = A[h][i]; } score += ((a[0] < a[1]) ? -1 : +1) * (a[0] + a[1]); } if (score > 0) { nmr += 1.0; } } writefln("%.10f", nmr / NUM_TRIES); } } catch (EOFException e) { } }