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