#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, s, x;
  int a[100000], p[100000];
  scanf("%ld", &n);
  s = 0;
  x = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    scanf("%d", &p[i]);
  }
  x = p[0];
  s += a[0] * x;
  for (int i = 1; i < n; i++) {
    if (p[i] <= x) {
      x = p[i];
    }
    s += a[i] * x;
  }
  printf("%ld", s);
  return 0;
}
