#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int need[n];
  int price[n];
  for (int i = 0; i < n; ++i) {
    cin >> need[i];
    cin >> price[i];
  }
  vector<int> index;
  long long ans = 0;
  long long tmp;
  int i = 0;
  while (i < n) {
    index.clear();
    tmp = 0;
    index.push_back(i);
    for (int j = i + 1; j < n; ++j) {
      if (price[j] < price[i]) {
        break;
      } else {
        index.push_back(j);
      }
    }
    for (int j = 0; j < index.size(); ++j) {
      tmp = tmp + need[index[j]];
    }
    ans = ans + tmp * price[i];
    i = i + index.size();
  }
  cout << ans << endl;
  return 0;
}
