#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> arr(n);
  int m = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
  }
  int min = 0;
  for (int i = 0; i < n; i++) {
    if (arr[min].second < arr[i].second) {
      m += arr[i].first * arr[min].second;
    } else {
      m += arr[i].first * arr[i].second;
      min = i;
    }
  }
  cout << m << endl;
  return 0;
}
