import java.io.*; import java.util.*; public class Main_yukicoder173 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Printer pr = new Printer(System.out); int n = sc.nextInt(); int pa = (int)(sc.nextDouble() * 1000); int pb = (int)(sc.nextDouble() * 1000); int[] a = new int[n]; int[] b = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } for (int i = 0; i < n; i++) { b[i] = sc.nextInt(); } Arrays.sort(a); Arrays.sort(b); int win = 0; int loop = 1_000_000; for (int i = 0; i < loop; i++) { int aa = 0; int bb = 0; int maska = 0; int maskb = 0; int mask = (0x1 << n) - 1; int[] sa = new int[n]; int[] sb = new int[n]; for (int j = 0; j < n; j++) { int mina = Integer.numberOfTrailingZeros(~maska & mask); int minb = Integer.numberOfTrailingZeros(~maskb & mask); if (j == n - 1) { sa[j] = mina; sb[j] = minb; } else { int ra = (int)(Math.random() * 1000); int rb = (int)(Math.random() * 1000); if (ra < pa) { sa[j] = mina; maska |= 0x1 << mina; } else { // int tmp = (int)((double)(ra + 1 - pa) / (1000 - pa) * (n - j - 1)); int tmp = (int)(Math.random() * (n - j - 1)); for (int k = mina + 1; k < n; k++) { if ((maska & 0x1 << k) != 0) { continue; } if (tmp == 0) { sa[j] = k; maska |= 0x1 << k; break; } tmp--; } } if (rb < pb) { sb[j] = minb; maskb |= 0x1 << minb; } else { // int tmp = (int)((double)(rb + 1 - pb) / (1000 - pb) * (n - j - 1)); int tmp = (int)(Math.random() * (n - j - 1)); for (int k = minb + 1; k < n; k++) { if ((maskb & 0x1 << k) != 0) { continue; } if (tmp == 0) { sb[j] = k; maskb |= 0x1 << k; break; } tmp--; } } } } for (int j = 0; j < n; j++) { if (a[sa[j]] > b[sb[j]]) { aa += a[sa[j]] + b[sb[j]]; } else { bb += a[sa[j]] + b[sb[j]]; } } if (aa > bb) { win++; } } pr.printf("%.4f\n", (double)win / loop); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }