#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a[100000], p[100000], i, rate, sum = 0;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i] >> p[i];
  rate = p[0];
  sum = a[0] * p[0];
  for (i = 1; i < n; i++) {
    if (p[i] < rate) rate = p[i];
    sum += a[i] * rate;
  }
  cout << sum;
  return 0;
}
