#include <bits/stdc++.h>
using namespace std;
int dr[] = {0, -1, 1, 0, -1, 1, -1, 1};
int dc[] = {-1, 0, 0, 1, 1, -1, -1, 1};
int main() {
  long long int n, a, b, answer = 0, current = INT_MAX;
  cin >> n;
  for (int(i) = (0); (i) < (n); ++(i)) {
    cin >> a >> b;
    if (b < current) current = b;
    answer += a * current;
  }
  cout << answer << endl;
}
