#include <bits/stdc++.h>

using namespace std;

int n;
double u,r,t,to,o;
pair<double,double> F[200001];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> F[i].second >> F[i].first;
    }
    sort(F,F+n);
    for(int i=n-1; i>=0; i--)
    {
        u += F[i].second;
        to = double(int(((int(100 * F[i].first)+1) * u)) % 10000);
        t = int(((int(100 * F[i].first)+1) * u) / 10000);
        if(t>r)
        {
            r = t;
            o = to;
        }
    }
    cout << r << "." << o <<endl;
    return 0;
}