#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n][2];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 2; j++) cin >> arr[i][j];
  int min = arr[0][1], sum = 0;
  sum += min * arr[0][0];
  for (int i = 1; i < n; i++) {
    if (arr[i][1] < min) {
      min = arr[i][1];
      sum += min * arr[i][0];
    } else {
      sum += min * arr[i][0];
    }
  }
  cout << sum;
}
