#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  vector<int> meat;
  vector<pair<int, int> > money;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int a, b;
    cin >> a >> b;
    meat.push_back(a);
    money.push_back(make_pair(b, i));
  }
  sort(money.begin(), money.end());
  int hsl = 0;
  for (int i = 0; i < t; i++) {
    for (int j = money[i].second; j < t; j++) {
      if (meat[j] == -1) break;
      hsl += (money[i].first * meat[j]);
      meat[j] = -1;
    }
  }
  cout << hsl << endl;
}
