#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int a, b, c, n, m;
pair<int, int> d[100007];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> d[i].first >> d[i].second;
  m = d[1].second * d[1].first;
  b = 1;
  for (int i = 2; i <= n; i++) {
    if (d[i].second > d[b].second)
      m += d[i].first * d[b].second;
    else
      b = i, m += d[i].first * d[i].second;
  }
  cout << m << endl;
  return 0;
}
