#include <bits/stdc++.h>
using namespace std;
unsigned int n, a, p, mi, s, i;
int main() {
  cin >> n;
  cin >> a >> mi;
  s = s + a * mi;
  for (i = 2; i <= n; i++) {
    cin >> a >> p;
    if (p < mi) mi = p;
    s = s + a * mi;
  }
  cout << s << endl;
  return 0;
}
