#include <bits/stdc++.h>
using namespace std;
bool Compare(const pair<int, int> &a, const pair<int, int> &b) {
  return a.first < b.first;
}
const int INF = 0x3f3f3f3f;
string tostring(long long int Number) {
  string String;
  ostringstream Convert;
  Convert << Number;
  String = Convert.str();
  return String;
}
long long int toint(string String) {
  stringstream Convert(String);
  long long int Number = 0;
  Convert >> Number;
  return Number;
}
int main() {
  int n, i;
  while (cin >> n) {
    int a[n + 2], p[n + 2];
    a[n + 1] = 0;
    p[n + 1] = 0;
    for (i = 1; i <= n; i++) {
      cin >> a[i] >> p[i];
    }
    int x, y = 0, first;
    int money = 0;
    for (i = 1; i <= n; i++) {
      x = p[i];
      y = 0;
      if (p[i] > p[i + 1])
        money += a[i] * p[i];
      else {
        first = p[i + 1];
        bool ck = false;
        while (x <= first) {
          y += a[i];
          i += 1;
          first = p[i];
          ck = true;
        }
        money += x * y;
        if (ck == true) i -= 1;
      }
    }
    cout << money << endl;
  }
  return 0;
}
