#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 1000000000;
  int ans = 0;
  cin >> n;
  while (n--) {
    int a, p;
    cin >> a >> p;
    if (p < m) m = p;
    ans += (a * m);
  }
  cout << ans;
  return 0;
}
