import random from heapq import heappush,heappop N=int(input()) A=[int(i) for i in input().split()] R=[int(i) for i in input().split()] def solve(): ans=0 q=[] for i in range(N): heappush(q,A[i]) if random.randrange(2): ans+=heappop(q)*R[i] return ans X=0 Y=0 import time start=time.time() while(time.time()-start<4.9): X+=solve() Y+=1 print(X/Y)