#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, mon = 0;
  cin >> n;
  vector<int> a(n), p(n);
  for (long int i = 0; i < n; i++) {
    cin >> a[i] >> p[i];
  }
  int k = 0;
  for (long int j = 0; j < n; j++) {
    k = j + 1;
    if (a[j] > 0) {
      mon += a[j] * p[j];
    }
    while (p[j] < p[k] && k < n) {
      mon += p[j] * a[k];
      a[k] = 0;
      k++;
    }
  }
  cout << mon;
}
