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