import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, PA, PB = readline().split() N, PA, PB = int(N), float(PA), float(PB) A = sorted(map(int, readline().split())) B = sorted(map(int, readline().split())) def compute_prob(N, P): # dp[i,j,k] = 残り1+i枚時点で、カードjが手元にある。それは手元の中でk番目である。 dp = np.zeros((N, N, N)) for j in range(N): dp[N - 1, j, j] = 1.0 for i in range(N - 1, 0, -1): q = (1 - P) / i dp[i - 1] += q * dp[i] * np.arange(i, i - N, -1)[None, :] dp[i - 1, :, :-1] += dp[i, :, 1:] * (P + q * np.arange(N - 1))[None, :] # 提出確率に変更 for i in range(N): if i == 0: p, q = 1.0, 0.0 else: p, q = P, (1 - P) / i dp[i, :, 0] *= p dp[i, :, 1:] *= q return dp.sum(axis=2) prob_a = compute_prob(N, PA) prob_b = compute_prob(N, PB) answer = 0 for j in range(N): for k in range(N): x, y = A[j], B[k] if x <= y: continue p = np.sum(prob_a[:, j] * prob_b[:, k]) answer += p * (x + y) print(answer)