#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-10;
const double PI = acos(-1.0);
const int maxn = 100009;
const int maxm = 1000009;
int a[maxn], p[maxn];
int main() {
  int n, res;
  while (cin >> n) {
    res = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &a[i], &p[i]);
    }
    res += a[0] * p[0];
    for (int i = 1; i < n; i++) {
      p[i] = min(p[i], p[i - 1]);
      res += a[i] * p[i];
    }
    cout << res << endl;
  }
  return 0;
}
