#include #include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; template vector> vec2d(int n, int m, T v){ return vector>(n, vector(m, v)); } template vector>> vec3d(int n, int m, int k, T v){ return vector>>(n, vector>(m, vector(k, v))); } template void print_vector(vector v, char delimiter=' '){ if(v.empty()) { cout << endl; return; } for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter; cout << v.back() << endl; } using P = pair; using T = tuple; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int n; cin >> n; vector a(n), b(n); for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < n; i++) cin >> b[i]; auto f = [&](ll a, ll b){ double x = sqrt((double)a/(double)b); return max(x, 1.0); }; vector vt = {T(a.back(), b.back(), f(a.back(), b.back()))}; for(int i = n-2; i >= 0; i--){ auto [a_next, b_next, x_next] = vt.back(); double x = f(a[i], b[i]); if(x < x_next){ vt.push_back(T(a[i], b[i], x)); }else{ vt.pop_back(); ll aa = a_next+a[i], bb = b_next+b[i], xx = f(a[i]+a_next, b[i]+b_next); vt.push_back(T(aa, bb, xx)); } } double ans = 0.0; for(auto [a, b, x]: vt){ ans += (double)a/x + (double)b*x; } cout << ans << endl; }