#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>

using namespace std;

void sortrows(std::vector<std::vector<double>>& matrix, int col) {
    std::sort(matrix.begin(),
              matrix.end(),
              [col](const std::vector<double>& lhs, const std::vector<double>& rhs) {
                  return lhs[col] < rhs[col];
              });
}

int main()
{
    int n;
    cin >> n;
    vector <vector<double>> p(n),sum(n);
    double x,y;
    for (int i=0; i<n; i++)
    {
        cin >> y >> x;
        p[i].push_back(y);
        p[i].push_back(x);
    }
    sortrows(p,1);
    double s[200000];
    s[0]=p[0][0];
    for (int i=1; i<n; i++)
    {
        s[i]=s[i-1]+p[i][0];
    }
    double r=0;
    for (int i=0; i<n; i++)
        if(p[i][1]>r)
    r=p[i][1]*s[i];
    cout << r;
    return 0;
}