#include <bits/stdc++.h>
using namespace std;
const int oo = 1e5 + 10;
int n, a[oo], p[oo], anss, mi[oo];
int main() {
  int t = 10;
  for (int i = 0; i < 10; i++) t++;
  mi[0] = oo;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i] >> p[i];
  for (int i = 1; i <= n; i++)
    if (p[i] < mi[i - 1])
      mi[i] = p[i];
    else
      mi[i] = mi[i - 1];
  for (int i = 1; i <= n; i++) anss += mi[i] * a[i];
  cout << anss << endl;
  return 0;
}
