#include <bits/stdc++.h>
using namespace std;
typedef struct meat {
  long long int q, p;
};
int main() {
  long long int n, sum = 0, mni = 1000007, d = 0;
  cin >> n;
  meat m[n + 1];
  for (long long int i = 1; i <= n; i++) {
    cin >> m[i].q >> m[i].p;
    sum += m[i].q;
  }
  for (long long int i = 1; i <= n; i++) {
    if (mni > m[i].p) mni = m[i].p;
    d += (m[i].q * mni);
  }
  cout << d << endl;
}
