#include <bits/stdc++.h>
using namespace std;
int n, m, a[1000000], b[1000000], ans = 0;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 1; i < n; i++)
    if (b[i] > b[i - 1]) b[i] = b[i - 1];
  for (int i = 0; i < n; i++) ans += a[i] * b[i];
  cout << ans;
}
