#include <bits/stdc++.h>
int main() {
  int n, a, p, res = 0, min = 10000;
  scanf("%d", &n);
  for (int i = n; i > 0; i--) {
    scanf("%d %d", &a, &p);
    if (p < min) min = p;
    res += min * a;
  }
  printf("%d\n", res);
  return 0;
}
