#include <bits/stdc++.h>
using namespace std;
vector<long long> v[105];
int main() {
  long long i, j;
  long long N;
  cin >> N;
  long long arr[N];
  for (i = 0; i < N; i++) {
    long long cost;
    cin >> arr[i] >> cost;
    v[cost].push_back(i);
  }
  for (i = 1; i <= 100; i++) sort(v[i].begin(), v[i].end());
  long long prev = N - 1;
  long long ans = 0;
  for (i = 1; i <= 100; i++) {
    if (v[i].size() > 0) {
      if (v[i][0] <= prev) {
        for (j = v[i][0]; j <= prev; j++) ans += i * arr[j];
        prev = v[i][0] - 1;
      }
    }
  }
  cout << ans;
  return 0;
}
