#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int>> v1;
  int n, s, x, sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s >> x;
    v1.push_back(make_pair(s, x));
  }
  int best = v1[0].second;
  sum += v1[0].first * best;
  for (int i = 1; i < n; i++) {
    if (best < v1[i].second)
      sum += v1[i].first * best;
    else {
      best = v1[i].second;
      sum += v1[i].first * best;
    }
  }
  cout << sum << endl;
  return 0;
}
