#include <bits/stdc++.h>
#define amfetamin ios_base::sync_with_stdio(false); cin.tie(NULL); cerr.tie(NULL); cout.tie(NULL);
using namespace std;
double n, temp, arr[1000009], sum, p[1000009], prosek, mx = 0, q;
int main() {
amfetamin
cin >> n;

for (int i = 1; i <= n; i++) {
    cin >> arr[i] >> p[i];
}

for (int i = 1; i <= n; i++) {
    sum = 0;
    for (int j = n; j >= 1; j--) {
        if (p[j] >= p[i]) {
            sum += arr[j];
        }
    }
mx = max(mx, sum*p[i]);
}

cout << mx <<endl;

return 0;
}