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

using namespace std;

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

    int n;
    cin >> n;
    pair<float, int> fl[MAXN];
    for (int i = 0; i < n; i++)
    {
        cin >> fl[i].se >> fl[i].fi;
    }
    sort(fl, fl+n, greater);
    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;
}