#include <bits/stdc++.h>
using namespace std;
long long t, a, b, sum, n;
pair<int, int> arr[100005];
int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    arr[i] = pair<int, int>(a, b);
  }
  long long solve = arr[0].first * arr[0].second;
  int pos = 0;
  for (int i = 1; i < n; i++) {
    if (arr[pos].second > arr[i].second) {
      solve += arr[i].first * arr[i].second;
      pos = i;
    } else {
      solve += arr[i].first * arr[pos].second;
    }
  }
  printf("%lld\n", solve);
}
