import sys readline = sys.stdin.readline n = int(readline()) *A, = map(int,readline().split()) *B, = map(int,readline().split()) q = [] ans = 0.0 for a,b in zip(A,B): while q and a <= b: x,y = q.pop() a += x b += y if a <= b: ans += a+b else: q.append((a,b)) qq = [] for a,b in q: while qq: x,y = qq[-1] if b*x >= a*y: qq.pop() a += x b += y else: break qq.append((a,b)) for x,y in qq: ans += 2*(1.0*x*y)**0.5 print(ans)