#include <bits/stdc++.h>
using namespace std;
void findmin(int* p, int* quant, int* min, int* price1, int j, int* sumprice) {
  if (p[j] < p[min[j - 1]]) {
    min[j] = j;
    price1[j] = p[j] * quant[j];
    sumprice[j] = sumprice[j - 1] + price1[j];
  } else {
    min[j] = min[j - 1];
    price1[j] = p[min[j - 1]] * quant[j];
    sumprice[j] = sumprice[j - 1] + price1[j];
  }
}
int main() {
  int nodays;
  cin >> nodays;
  int* quant = new int[nodays];
  int* price = new int[nodays];
  for (int i = 0; i < nodays; i++) {
    cin >> quant[i];
    cin >> price[i];
  }
  int* min = new int[nodays];
  int* price1 = new int[nodays];
  int* sumprice = new int[nodays];
  min[0] = 0;
  price1[0] = price[0];
  sumprice[0] = price[0] * quant[0];
  for (int i = 1; i < nodays; i++) {
    min[i] = 0;
    price1[i] = 0;
    sumprice[i] = 0;
  }
  for (int i = 1; i < nodays; i++) {
    findmin(price, quant, min, price1, i, sumprice);
  }
  cout << sumprice[nodays - 1] << "\n";
}
