#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, j, a, b, mi, cost, sum, k, l;
  while (scanf("%d", &n) == 1) {
    sum = 0;
    mi = 100000000;
    while (n--) {
      scanf("%d %d", &a, &b);
      if (b < mi) mi = b;
      sum += a * mi;
    }
    printf("%d\n", sum);
  }
}
