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