#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int cost = 0;
  cin >> n;
  int* a = new int[n];
  int* p = new int[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> p[i];
  }
  cost += a[0] * p[0];
  for (int i = 0; i < n - 1; ++i) {
    if (p[i] < p[i + 1]) {
      int j = i;
      while (p[j] <= p[i + 1] && i < n - 1) {
        cost += a[i + 1] * p[j];
        ++i;
      }
      --i;
    } else {
      cost += (a[i + 1] * p[i + 1]);
    }
  }
  cout << cost;
  delete[] a;
  delete[] p;
  return 0;
}
