#include <bits/stdc++.h>
using namespace std;
inline int min_index(vector<int> first, int l, int h) {
  int min = 99999, res = 0;
  for (int i = l; i < h; i++)
    if (min > first[i]) res = i, min = first[i];
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n), p(n);
  vector<int> sums(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> p[i];
  sums[0] = a[0];
  for (int i = 1; i < n; i++) sums[i] = sums[i - 1] + a[i];
  int m = n, m1;
  int sum = 0;
  while ((m1 = min_index(p, 0, m)) != 0)
    sum += (sums[m - 1] - sums[m1] + a[m1]) * p[m1], m = m1;
  sum += (sums[m - 1]) * p[0];
  cout << sum << endl;
  return 0;
}
