#include using namespace std; const double INF = 1000000000; int main(){ cout << fixed << setprecision(20); int N; cin >> N; vector A(N); for (int i = 0; i < N; i++){ cin >> A[i]; } vector B(N); for (int i = 0; i < N; i++){ cin >> B[i]; } vector SA(N + 1), SB(N + 1); SA[N] = 0; SB[N] = 0; for (int i = N - 1; i >= 0; i--){ SA[i] = SA[i + 1] + A[i]; SB[i] = SB[i + 1] + B[i]; } vector X; for (int i = 0; i < N; i++){ double x = sqrt((double) SA[i] / SB[i]); if (x > 1){ X.push_back(x); } } X.push_back(1); sort(X.begin(), X.end()); int M = X.size(); vector dp(M, 0); for (int i = N - 1; i >= 0; i--){ for (int j = 0; j < M; j++){ dp[j] += A[i] / X[j] + B[i] * X[j]; } for (int j = M - 2; j >= 0; j--){ dp[j] = min(dp[j], dp[j + 1]); } } cout << dp[0] << endl; }