#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n], b[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  long long sum = 0;
  long long price = 99999;
  for (long long i = 0; i < n; i++) {
    price = min(price, b[i]);
    sum += price * a[i];
  }
  cout << sum << endl;
}
