#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  pair<long long, long long> pii[n];
  for (long long i = 0; i < n; i++) {
    cin >> pii[i].first >> pii[i].second;
  }
  long long lowest_per_kg = pii[0].second;
  long long min_cost = 0;
  for (long long i = 0; i < n; i++) {
    lowest_per_kg = min(lowest_per_kg, pii[i].second);
    min_cost += pii[i].first * lowest_per_kg;
  }
  cout << min_cost << endl;
  return 0;
}
