#include <bits/stdc++.h>
#define MAXN 200010
#define fi first
#define se second

using namespace std;

bool great(pair<double, int> a,pair<double, int> b)
{
    return a.fi > b.fi;
}

pair<double, int> fl[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> fl[i].se >> fl[i].fi;
    }
    sort(fl, fl+n, great);
    double maks = -1;
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum += fl[i].se;
        if (sum * fl[i].fi > maks) maks = sum * fl[i].fi;
        cout << fl[i].se << ' ';
    }
    cout << fixed << '\n' << maks / 100;
    return 0;
}