#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0, kg, cost, cost1;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> kg >> cost;
    if (i > 0) {
      cost = cost < cost1 ? cost : cost1;
      sum += (cost * kg);
      cost1 = cost;
    } else {
      sum += (cost * kg);
      cost1 = cost;
    }
  }
  cout << sum;
  return 0;
}
