#!/c/Python34/python # coding: utf-8 import random def simulate(n, pa, pb, A, B): a = b = 0 a += 1 for _ in range(n): ra, rb = random.random(), random.random() i, j = -1, -1 if ra > pa and len(A) > 1: i = random.randrange(len(A)-1) if rb > pb and len(B) > 1: j = random.randrange(len(B)-1) if A[i] > B[j]: a += A[i] + B[j] else: b += A[i] + B[j] del A[i], B[j] 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()