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): a=A[i]; b=B[i] while bool(S) and S[-1][0]/S[-1][1]>a/b: Sa,Sb=S.pop() a+=Sa; b+=Sb S.append((a,b)) T=0 for a,b in S: if a>b: T+=2*sqrt(a*b) else: T+=a+b print(T)