from itertools import permutations n = int(input()) A, B = [[int(x) for x in input().split()] for i in range(2)] win = 0 cnt = 0 def fight(a: tuple, b: tuple) -> None: global win, cnt mini_win = 0 cnt += 1 for i in range(n): if a[i] > b[i]: mini_win += 1 else: mini_win -= 1 if mini_win > 0: win += 1 def main() -> None: for Ai in permutations(A): for Bi in permutations(B): fight(Ai, Bi) print("{:.2}".format(win / cnt)) if __name__ == "__main__": main()