#include <bits/stdc++.h>
using namespace std;
unsigned long long x = 0, a, p[111111], g[111111], min = 99999999;
int main() {
  cin >> a;
  for (int i = 1; i <= a; i++) {
    cin >> p[i] >> g[i];
  }
  for (int i = 1; i <= a; i++) {
    if (g[i] < g[i + 1]) {
      x += p[i] * g[i];
      g[i + 1] = g[i];
    } else {
      x += p[i] * g[i];
    }
  }
  cout << x;
  return 0;
}
