#include <bits/stdc++.h>

using namespace std;

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

    vector<pair<double, int> > v;

    int n;
    pair<double, int> p;
    long double curr = 0, res = 0;

    cin >> n;

    for (int i = 0; i < n; ++i) {
        cin >> p.second >> p.first;

        v.emplace_back(p);
    }

    sort(v.rbegin(), v.rend());

    for (int i = 0; i < n; ++i) {
        curr += double(v[i].second);

        if (double(curr * v[i].first) > res) {
            res = curr * v[i].first;
        }
    }

    cout << res;
}