#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n, arr1[100000], arr2[100000], mn = 1e9, sum = 0, res = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr1[i] >> arr2[i];
  }
  for (int i = 0; i < n; i++) {
    if (arr2[i] < mn) {
      sum += (res * mn);
      mn = arr2[i];
      res = arr1[i];
    } else {
      res += arr1[i];
    }
  }
  sum += res * mn;
  cout << sum << endl;
  return 0;
}
