#int(input()) #map(int, input().split()) #list(map(int, input().split())) N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 x = 0 def time(x, a, b): return a / (1 + x) + b * (1 + x) ans = 0 c = [] a = 0 b = 0 for i in range(N): a += A[i] b += B[i] c.append([max(1, (a/b)**0.5)-1, i+1]) c = sorted(c, reverse=True) k = 0 u = [0] * N while c: t = c.pop() if t[1] > k: sa = 0 sb = 0 for i in range(k, t[1]): sa += A[i] sb += B[i] for i in range(k, t[1]): u[i] = max(0, (sa/sb) ** 0.5 - 1) k = t[1] for i in range(N): ans += time(u[i], A[i], B[i]) print(ans)