#include <bits/stdc++.h>

using namespace std;

bool cmp(const pair<pair<int,double>,double>& p1, const pair<pair<int,double>,double>& p2){
    return p1.first.second>p2.first.second;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<pair<pair<int,double>,double>> frilenseri(n);
    for(int i=0;i<n;i++){
        cin>>frilenseri[i].first.first>>frilenseri[i].first.second;
        frilenseri[i].second=frilenseri[i].first.first;
    }
    sort(frilenseri.begin(),frilenseri.end(),cmp);
    vector<double> svi_zbirovi;
    for(int i=0;i<n;i++){
        double zbir=0;
        for(int j=0;j<=i;j++){
            zbir+=(frilenseri[j].second*frilenseri[i].first.second);
        }
        svi_zbirovi.push_back(zbir);
        cout<<zbir<<endl;
    }
    cout<<*(max_element(svi_zbirovi.begin(),svi_zbirovi.end()));
    return 0;
}