#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a, p;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a.push_back(x);
    p.push_back(y);
  }
  int cost = 0, bought = 0;
  while (bought < n) {
    int new_cost = p[bought];
    int taken = 0, done = 0;
    for (int i = bought; i < n; i++) {
      if (new_cost <= p[i]) {
        taken += a[i];
        done++;
      } else
        break;
    }
    cost += taken * new_cost;
    bought += done;
  }
  cout << cost << endl;
  return 0;
}
