#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  int i, p, a, pp, aa;
  for (i = 0; i < n; i++) {
    cin >> a >> p;
    if (i) {
      if (p > pp) p = pp;
    }
    ans += a * p;
    aa = a;
    pp = p;
  }
  cout << ans << "\n";
  return 0;
}
