#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> a, p;
  int ans = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int j, k;
    cin >> j >> k;
    a.push_back(j);
    p.push_back(k);
  }
  int mini = 101;
  int have = 0;
  int money = 0;
  for (int i = 0; i < n; ++i) {
    if (have >= a[i]) {
      have -= a[i];
      continue;
    }
    for (int j = i + 1; j < n; ++j) {
      if (p[i] < p[j])
        have += a[j];
      else
        break;
    }
    money += (have + a[i]) * p[i];
  }
  cout << money;
  return 0;
}
