#include using namespace std; int main(){ int n; cin>>n; vectora(n),b(n); for(int i=0;i>a[i]; for(int i=0;i>b[i]; vector>ret; for(int i=n-1;i>=0;i--){ long long now_a=a[i],now_b=b[i]; while(ret.size()&&!((double)ret.back().first/ret.back().second>=(double)now_a/now_b)){ now_a+=ret.back().first; now_b+=ret.back().second; ret.pop_back(); } ret.push_back({now_a,now_b}); } double ans=0; for(auto&[x,y]:ret){ if(x>=y)ans+=2.0*sqrt(x)*sqrt(y); else ans+=x+y; } cout<