#include <bits/stdc++.h>
using namespace std;
long long a[100100][2], sum, mn = 1e9, n;
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < 2; j++) cin >> a[i][j];
  for (long long i = 0; i < n; i++) {
    mn = min(mn, a[i][1]);
    sum += mn * a[i][0];
  }
  cout << sum << endl;
  return 0;
}
