#include <bits/stdc++.h>
using namespace std;
int n, a[100005], p[100005];
long long cost;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> p[i];
  }
  int mn = p[0];
  for (int i = 0; i < n; ++i) mn = min(p[i], mn), cost += mn * 1LL * a[i];
  cout << cost << endl;
  return 0;
}
