#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, m, res = 0;
  cin >> n;
  cin >> a >> b;
  m = b;
  res = a * b;
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    m = min(m, b);
    res += a * m;
  }
  cout << res;
  return 0;
}
