#include <bits/stdc++.h>
int a[100005] = {};
int p[100005] = {};
int mbuy[100005] = {};
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  int n, currmin = 1000000, buy = 0, last = 0;
  std::cin >> n;
  for (int i = 0; i < n; i++) std::cin >> a[i] >> p[i];
  for (int i = 0; i < n; i++) {
    if (p[i] < currmin) {
      mbuy[last] = buy;
      currmin = p[i];
      last = i;
      buy = 0;
    }
    buy += a[i];
  }
  mbuy[last] = buy;
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += mbuy[i] * p[i];
  }
  std::cout << ans << '\n';
}
