#include <bits/stdc++.h>
using namespace std;
int tedad(int a[], int n, int i) {
  int k = 0;
  for (int j = i + 1; j < n; j++) {
    if (a[i] <= a[j]) {
      k++;
    } else
      break;
  }
  return k;
}
int vazn(int b[], int n, int i) {
  int c = 0;
  for (int k = i; k < n + 1 + i; k++) {
    c += b[k];
  }
  return c;
}
int main() {
  int n, k, c = 0, f;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> b[i] >> a[i];
  }
  for (int i = 0; i < n; i++) {
    k = tedad(a, n, i);
    f = vazn(b, k, i) * a[i];
    i += k;
    c += f;
  }
  cout << c;
  return 0;
}
