#include <bits/stdc++.h>
using namespace std;
void print(int a[], int n) {
  for (int i = 1; i < n; i++) cout << a[i] << " ";
  cout << endl;
}
int main() {
  int n;
  cin >> n;
  int eat[n + 1], cost[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> eat[i] >> cost[i];
  }
  int cost_min[n];
  cost_min[1] = cost[1];
  int min = cost[1];
  for (int i = 1; i <= n; i++) {
    if (cost[i] < min) {
      cost_min[i] = cost[i];
      min = cost[i];
    } else
      cost_min[i] = min;
  }
  int money = 0;
  for (int i = 1; i <= n; i++) {
    money += eat[i] * cost_min[i];
  }
  cout << money << endl;
}
