import random N, PA, PB = input().split() A = list(map(int, input().split())) B = list(map(int, input().split())) A.sort(reverse=True) B.sort(reverse=True) N = int(N) PA, PB = int(float(PA) * 1000) , int(float(PB) * 1000) win = 0 def f(L, P): temp = [] for i in range(N): v = random.randint(1, 1000) if v <= P or i == N - 1: temp.append(L.pop()) else: ind = random.randint(0, len(L) - 2) temp.append(L.pop(ind)) return temp for _ in range(10 ** 6): LA, LB = [], [] for i in range(N): LA.append(A[i]) LB.append(B[i]) VA = f(LA, PA) VB = f(LB, PB) SA, SB = 0, 0 for a, b in zip(VA, VB): if a > b: SA += a + b else: SB += a + b if SA > SB: win += 1 print(win/10**6)