#include <bits/stdc++.h>
using namespace std;
struct temp {
  int need, price;
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  while (test--) {
    int n;
    cin >> n;
    vector<temp> arr(n);
    for (int i = 0; i < n; ++i) cin >> arr[i].need >> arr[i].price;
    long long total_cost = 0, i = 0;
    while (i < n) {
      long long current_need = 0;
      int min_price = arr[i].price;
      int pos = i;
      current_need += arr[i].need;
      i++;
      while (arr[pos].price < arr[i].price && i < n) {
        current_need += arr[i].need;
        i++;
      }
      total_cost += min_price * current_need;
    }
    cout << total_cost << '\n';
  }
  return 0;
}
