#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s = 0, t;
  cin >> n;
  vector<vector<int>> v(n, vector<int>(2));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) cin >> v[i][j];
  }
  int min = v[0][1];
  for (int i = 0; i < n; i++) {
    if (v[i][1] > min) {
      s += v[i][0] * min;
    } else {
      min = v[i][1];
      s += v[i][0] * min;
    }
  }
  cout << s << endl;
  return 0;
}
