#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, cost;
  cin >> eat >> cost;
  int min = cost, money = min * eat;
  for (int i = 2; i <= n; i++) {
    cin >> eat >> cost;
    if (cost > min) {
      money += min * eat;
    } else {
      money += cost * eat;
      min = cost;
    }
  }
  cout << money << endl;
}
