#include <bits/stdc++.h>
using namespace std;
int n, v[100005], p[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> v[i] >> p[i];
  int ans = 0;
  int in = 1;
  while (in <= n) {
    int in2 = in + 1, meat = p[in] * v[in];
    while (p[in2] >= p[in] && in2 <= n) {
      meat += p[in] * v[in2];
      ++in2;
    }
    ans += meat;
    in = in2;
  }
  cout << ans;
  return 0;
}
