#include <bits/stdc++.h>
using namespace std;
int A[100005], P[100005], mark[100005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) cin >> A[i] >> P[i];
  int ans = 0, m = P[1];
  ans = A[1] * m;
  mark[1] = P[1];
  for (int i = 2; i <= n; i++) {
    mark[i] = min(mark[i - 1], P[i]);
    ans = ans + A[i] * mark[i];
  }
  cout << ans;
  return 0;
}
