#include <bits/stdc++.h>
using namespace std;
int n, x, t;
int a[100100], b[100100];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
  }
  x = a[1] * b[1];
  t = b[1];
  for (int i = 2; i <= n; i++) {
    if (b[i] <= t) {
      x = x + b[i] * a[i];
      t = b[i];
    } else {
      x = x + a[i] * t;
    }
  }
  cout << x;
}
