#include <bits/stdc++.h>
using namespace std;
long long n, i, j, k, l, low, mid, high, d[100000];
int gcd(int m, int n) {
  if (m == 0)
    return m;
  else {
    return gcd(m, m % n);
  }
}
void do_the_question() {
  int n;
  cin >> n;
  int a[n], p[n];
  int less = 100000;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> p[i];
  }
  int flag = 0, cost = 0;
  for (int i = 0; i < n; i++) {
    less = min(p[i], less);
    cost += a[i] * less;
  }
  cout << cost << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  do_the_question();
  return 0;
}
