#include <bits/stdc++.h>
int main() {
  int a, i, tag, sum = 0;
  scanf("%d", &a);
  int meat[a];
  int price[a];
  for (i = 0; i < a; i++) scanf("%d %d", meat + i, price + i);
  int *minprc = &price[a];
  tag = a;
  int num = 0;
  do {
    minprc -= 1;
    num = 0;
    for (i = minprc - price; i >= 0; i--)
      if (*minprc >= price[i]) minprc = price + i;
    for (i = minprc - price; i < tag; i++) num += meat[i];
    sum = sum + (num * (*minprc));
    tag = minprc - price;
  } while (minprc != price);
  printf("%d", sum);
  return 0;
}
