#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, t = 0;
  cin >> n;
  short a[n][2];
  for (i = -0; i < n; i++) cin >> a[i][0] >> a[i][1];
  for (i = 0; i < n; i++) {
    short c = a[i][1];
    while (c <= a[i][1] && i < n) {
      t += a[i][0] * c;
      i++;
    }
    i--;
  }
  cout << t;
  return 0;
}
