from math import sqrt N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) S=[] for i in range(N): if bool(S) and S[-1][0]/S[-1][1]>A[i]/B[i]: S[-1][0]+=A[i] S[-1][1]+=B[i] else: S.append([A[i],B[i]]) T=0 for a,b in S: x=max(sqrt(a/b)-1,0) T+=a/(1+x)+b*(1+x) print(T)