#include int main(){ using namespace std; unsigned long N; cin >> N; vector> problems(N); for(auto&& [a, _] : problems)cin >> a; for(auto&& [_, b] : problems)cin >> b; reverse(begin(problems), end(problems)); vector> 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 ? a + b : sqrt(static_cast(4 * a * b)); cout << fixed << setprecision(30) << ans << endl; return 0; }