#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)(1e9);
const long double eps = 1e-6;
signed main() {
  long long n;
  cin >> n;
  long long mn = inf, cnt = 0;
  while (n--) {
    long long a, p;
    cin >> a >> p;
    mn = min(mn, p);
    cnt += mn * a;
  }
  cout << cnt << endl;
  return 0;
}
