#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, x, y, sum = 0, min = 1e9;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (y < min) min = y;
    sum += x * min;
  }
  cout << sum;
  return 0;
}
