#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <tuple>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;
class ReturnOfTheJedi { public:
vector <double> minimalExpectation(vector <int> x, vector <int> p)
{
vector<pair<double,double>> item;
for(int i=0; i<x.size(); ++i)
item.emplace_back(p[i]/100000.0, x[i]);
vector<double> ans(x.size());
vector<pair<double,double>> iA = item;
double pA = 1.0;
double xA = 0.0;
vector<pair<double,double>> iB = item;
double pB = 1.0;
double xB = 0.0;
{
vector<pair<double,double>>::iterator b1 = iB.begin();
double best_score = 1e+300;
for(vector<pair<double,double>>::iterator it = iB.begin(); it != iB.end(); ++it) {
double score = it->first * it->second;
if(best_score > score)
{b1 = it, best_score = score;}
}
pB = b1->first;
xB = b1->second;
iB.erase(b1);
ans[0] = (pB*xB);
}
for(int k=1; k<ans.size(); ++k) {
vector<pair<double,double>>::iterator b1 = iB.begin();
double best_score = 1e+300;
for(vector<pair<double,double>>::iterator it = iB.begin(); it != iB.end(); ++it) {
double score = pB*it->first * (xB+it->second);
if(best_score > score)
{b1 = it, best_score = score;}
}
vector<pair<double,double>>::iterator b2 = iA.begin();
vector<pair<double,double>>::iterator b3 = iA.begin();
bool A_mode = false;
for(vector<pair<double,double>>::iterator it = iA.begin(); it != iA.end(); ++it)
for(vector<pair<double,double>>::iterator kt = it; kt != iA.end(); ++kt) if(kt!=it){
double score = pA*it->first*kt->first * (xA+it->second+kt->second);
if(best_score > score)
{b2 = it, b3 = kt, best_score = score, A_mode = true;}
}
if(!A_mode) {
pA = pB;
xA = xB;
iA = iB;
pB *= b1->first;
xB += b1->second;
iB.erase(b1);
} else {
pA *= b2->first * b3->first;
xA += b2->second + b3->second;
auto xxx = *b3;
iA.erase(b2);
iA.erase(std::find(iA.begin(), iA.end(), xxx));
swap(pA, pB);
swap(xA, xB);
swap(iA, iB);
}
ans[k] = pB*xB;
}
return ans;
}
};
// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
{ ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
{ os << "{ ";
for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const vector <double>& Expected, const vector <double>& Received) {
bool ok = true;
for(int i=0; i<Expected.size(); ++i)
if( abs(Expected[i]-Received[i]) >= 1e-9 )
ok = false;
if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl;
cerr << "\to: " << Expected << endl << "\tx: " << Received << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END verify_case(_, ReturnOfTheJedi().minimalExpectation(x, p));}
int main(){
CASE(0)
int x_[] = {100,200,300};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int p_[] = {50000, 20000, 20000};
vector <int> p(p_, p_+sizeof(p_)/sizeof(*p_));
double __[] = {40.0, 20.000000000000004, 12.000000000000002 };
vector <double> _(__, __+sizeof(__)/sizeof(*__));
END
CASE(1)
int x_[] = {200,100,500,300,400};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int p_[] = {100000, 100000, 100000, 100000, 100000};
vector <int> p(p_, p_+sizeof(p_)/sizeof(*p_));
double __[] = {100.0, 300.0, 600.0, 1000.0, 1500.0 };
vector <double> _(__, __+sizeof(__)/sizeof(*__));
END
CASE(2)
int x_[] = {2,2,100,100};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int p_[] = {100000,100000,10000,10000};
vector <int> p(p_, p_+sizeof(p_)/sizeof(*p_));
double __[] = {2.0, 2.0000000000000004, 2.0200000000000005, 2.0400000000000005 };
vector <double> _(__, __+sizeof(__)/sizeof(*__));
END
CASE(3)
int x_[] = {1,1,200,200};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int p_[] = {100000,100000,10000,10000};
vector <int> p(p_, p_+sizeof(p_)/sizeof(*p_));
double __[] = {1.0, 2.0, 4.010000000000001, 4.0200000000000005 };
vector <double> _(__, __+sizeof(__)/sizeof(*__));
END
CASE(4)
int x_[] = {1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int p_[] = {90000,90000,90000,90000,90000,90000,90000,90000,90000,90000};
vector <int> p(p_, p_+sizeof(p_)/sizeof(*p_));
double __[] = {9.0E8, 1.62E9, 2.1870000000000005E9, 2.6244000000000005E9, 2.952450000000001E9, 3.188646000000001E9, 3.348078300000001E9, 3.4437376800000014E9, 3.4867844010000014E9, 3.4867844010000014E9 };
vector <double> _(__, __+sizeof(__)/sizeof(*__));
END
/*
CASE(5)
int x_[] = ;
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int p_[] = ;
vector <int> p(p_, p_+sizeof(p_)/sizeof(*p_));
double __[] = ;
vector <double> _(__, __+sizeof(__)/sizeof(*__));
END
CASE(6)
int x_[] = ;
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int p_[] = ;
vector <int> p(p_, p_+sizeof(p_)/sizeof(*p_));
double __[] = ;
vector <double> _(__, __+sizeof(__)/sizeof(*__));
END
*/
}
// END CUT HERE