#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    double a[n], b[n];
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    double k[n];
    for(int i=0;i<n;i++){
        k[i] = 0;
        for(int j=0;j<n;j++)
            if(b[i]>=b[j])
                k[i] +=(double) a[j] * b[i];
    }
    int maximum = k[0];
    for(int i=1;i<n;i++)
        if(maximum < k[i])
            maximum = k[i];
    cout<<maximum;
    return 0;
}