import random a = input().split() N = int(a[0]) PA = float(a[1]) PB = float(a[2]) A = list(map(int, input().split())) B = list(map(int, input().split())) A.sort() B.sort() def select(cards: list[int], prob: float) -> list[int]: cands = cards.copy() res = [] for i in range(len(cards)): p = random.random() if p <= prob or len(cands) == 1: res.append(cands[0]) del cands[0] else: k = random.randint(1, len(cands)-1) res.append(cands[k]) del cands[k] return res def judge(xs, ys) -> bool: fst = 0 snd = 0 for x, y in zip(xs, ys): if x > y: fst += x + y else: snd += x + y return fst > snd trials = 500_000 win = 0 for _ in range(trials): xs = select(A, PA) ys = select(B, PB) if judge(xs, ys): win += 1 ans = win / trials print(ans)