n = int(input()) a = sum(list(map(int,input().split()))) b = sum(list(map(int,input().split()))) result = (a*3-b*2)/(a-b) print(f'{result:.6f}')