from collections import * from itertools import * from functools import * from heapq import * import sys, math, random, time # input = sys.stdin.readline start = time.time() N, pa, pb = input().split() N = int(N) pa = float(pa) pb = float(pb) A = list(map(int, input().split())) B = list(map(int, input().split())) cnt = 0 win = 0 A.sort() B.sort() def f(): X = deque(A[:]) Y = deque(B[:]) a = 0 b = 0 while X: if len(X) == 1: if X[0] > Y[0]: a += 1 elif X[0] < Y[0]: b += 1 break if random.random() < pa: vx = X.popleft() else: vx = X[random.randint(1, len(X) - 1)] X.remove(vx) if random.random() < pb: vy = Y.popleft() else: vy = Y[random.randint(1, len(Y) - 1)] Y.remove(vy) if vx > vy: a += 1 if vx < vy: b += 1 return a > b while time.time() - start < 2.5: win += f() cnt += 1 print(win / cnt)