#!/c/Python34/python # coding: utf-8 import random def simulate(n, pa, pb, A, B): a = b = 0 for _ in range(n): ra, rb = random.random(), random.random() i, j = -1, -1 if ra > pa: i = random.randrange(len(A)) if rb > pb: j = random.randrange(len(B)) if A[i] > B[j]: a += A[i] + B[j] else: b += A[i] + B[j] del A[i], B[j] print(a, b) return a > b def main(): [n, pa, pb] = map(float, input().split()) n = int(n) A = sorted(list(map(int, input().split())), reverse=True) B = sorted(list(map(int, input().split())), reverse=True) win, check = 0, 100000 for _ in range(check): if simulate(n, pa, pb, A[:], B[:]): win += 1 print(win/check) if __name__ == '__main__': main()