import math n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=[0]*n asum=0 bsum=0 for i in range(n-1,-1,-1): asum+=a[i] bsum+=b[i] if asum>=bsum: c[i]=min(math.sqrt(a[i]/b[i])-1,math.sqrt(asum/bsum)-1) currmax=0 for i in range(n): currmax=max(currmax,c[i]) c[i]=currmax ans=0 for i in range(n): ans+=a[i]/(1+c[i]) ans+=b[i]*(1+c[i]) print(ans)