#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n], p[n];
  for (int i = 0; i < n; i++) cin >> a[i] >> p[i];
  long long minMoney = 0;
  for (int i = 0, j = 0; i < n; i++) {
    if (p[j] >= p[i]) {
      j = i;
    }
    minMoney += a[i] * p[j];
  }
  cout << minMoney << endl;
  return 0;
}
