#include <bits/stdc++.h>
using namespace std;
int a[100100];
int p[100100];
int main() {
  int n;
  scanf("%d", &n);
  int total = 0;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    total += x;
    a[i] = x;
    p[i] = y;
  }
  int total_temp = 0;
  int f = 0;
  int req_ans = 0;
  int mi = 9999999;
  for (int i = 0; i < n; i++) {
    if (p[i] < mi) {
      mi = p[i];
      req_ans += (p[i] * a[i]);
    } else {
      req_ans += (a[i] * mi);
    }
  }
  printf("%d\n", req_ans);
  return 0;
}
