#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  long long a[100005], p[100005];
  long long min;
  cin >> n;
  cin >> a[0] >> p[0];
  min = p[0];
  long long s = (min * a[0]);
  for (long int i = 1; i < n; i++) {
    cin >> a[i] >> p[i];
    if (p[i] < min) min = p[i];
    s += (min * a[i]);
  }
  cout << s;
}
