#include<bits/stdc++.h>
using namespace std;
struct temp
{
int weiglt,value;
temp(int w, int v): weiglt(w),value(v){}
};
bool tem(const temp &a, const temp &b)
{
double dj1 = (double) a.value / a.weiglt;
double dj2 = (double) b.value / b.weiglt;
return dj1 > dj2;
}
double biebao(vector<temp>& wp,int n)
{
sort(wp.begin(),wp.end(),tem);
double q = 0.0;
for(int i = 0; i < wp.size();i++)
{
if(wp[i].weiglt < n)
{
q+= wp[i].value;
n -= wp[i].weiglt;
}
else
{
q += wp[i].value * ((double)n / wp[i].weiglt);
break;
}
}
return q;
}
int main()
{
int n;
cin >> n;
vector<temp> wp
{
temp(20,120),
temp(50,240),
temp(30,150),
temp(10,50),
temp(40,210)
};
cout << biebao(wp,n);;
}
05-23
618
11-03