#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int meat_req[n];
  int meat_pri[n];
  for (int i = 0; i < n; i++) {
    cin >> meat_req[i] >> meat_pri[i];
  }
  int start_pos = 0;
  int curr_pos = 0;
  int cost = 0;
  while (curr_pos < n) {
    while ((meat_pri[curr_pos] >= meat_pri[start_pos]) && (curr_pos < n)) {
      cost += meat_req[curr_pos] * meat_pri[start_pos];
      curr_pos++;
    }
    start_pos = curr_pos;
  }
  cout << cost;
  return 0;
}
