#include<bits/stdc++.h>
using namespace std;
//vector pair
int main(){
double N, a, b, proc=0, suma=0, max=0;
cin >> N;
vector< pair <double, long int> > niz;
for(int i = 0; i < N; i++){
	cin >> a >> b;
	niz.push_back(make_pair (b,a));
} 
sort(niz.rbegin(), niz.rend());
for(auto i:niz){
	proc=i.first;
	suma+=i.second;
	if(proc * suma > max)max = proc * suma;
}
cout << max << endl;	
return 0;
}