import static java.lang.System.err; import static java.lang.System.out; import java.util.ArrayDeque; public class Main { public static void main(String[] args) { new Main(); out.flush(); err.flush(); } static class Pair { double A, B; double min; double score; Pair(double A, double B) { this.A = A; this.B = B; min = Math.max(0, Math.sqrt(A / B) - 1); score = A / (min + 1) + B * (min + 1); } @Override public String toString() { return "(" + A + ", " + B + ", " + min + ", " + score + ")"; } } /** * @author 31536000(@CuriousFairy315) */ public Main() { try (java.util.Scanner sc = new java.util.Scanner(System.in)) { int N = sc.nextInt(); long[] A = new long[N], B = new long[N]; for (int i = 0;i < N;++ i) A[i] = sc.nextInt(); for (int i = 0;i < N;++ i) B[i] = sc.nextInt(); ArrayDeque stack = new ArrayDeque<>(); for (int i = N - 1;i >= 0;-- i) { Pair push = new Pair(A[i], B[i]); while (!stack.isEmpty() && stack.peekLast().min < push.min) { Pair pop = stack.pollLast(); push = new Pair(push.A + pop.A, push.B + pop.B); } stack.add(push); // out.println(stack); } double ans = 0; for (Pair p : stack) ans += p.score; out.println(ans); } } }