#include <bits/extc++.h> #include <boost/multiprecision/cpp_int.hpp> int main(){ using namespace std; using bigint = boost::multiprecision::cpp_int; unsigned long N; cin >> N; vector<pair<bigint, bigint>> problems(N); for(auto&& [a, _] : problems)cin >> a; for(auto&& [_, b] : problems)cin >> b; reverse(begin(problems), end(problems)); vector<pair<bigint, bigint>> stack; while(!empty(problems)){ auto [a, b]{problems.back()}; problems.pop_back(); while(!empty(stack) && stack.back().first * b >= stack.back().second * a){ a += stack.back().first; b += stack.back().second; stack.pop_back(); } stack.emplace_back(a, b); } long double ans{}; for(const auto& [a, b] : stack)ans += a < b ? static_cast<long double>(a) + static_cast<long double>(b) : 2 * sqrt(static_cast<long double>(a)) * sqrt(static_cast<long double>(b)); cout << fixed << setprecision(30) << ans << endl; return 0; }