#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int qtd[100005];
  int mini[1000005];
  int n;
  cin >> n;
  int need, cost;
  cin >> need >> cost;
  qtd[0] = need;
  mini[0] = cost;
  for (int i = 1; i < n; i++) {
    cin >> need >> cost;
    qtd[i] = need;
    mini[i] = min(cost, mini[i - 1]);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += mini[i] * qtd[i];
  }
  cout << ans << '\n';
  return 0;
}
