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