#include <bits/stdc++.h>
using namespace std;
int arr[100004], arr1[100004];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i] >> arr1[i];
  int mn = arr1[0], ans = arr[0] * arr1[0];
  for (int i = 1; i < n; i++) {
    mn = min(mn, arr1[i]);
    ans += (arr[i] * mn);
  }
  cout << ans << endl;
}
