#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, ans = 0;
  cin >> n;
  vector<long long> a(n), p(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> p[i];
    if (i) {
      p[i] = min(p[i], p[i - 1]);
    }
  }
  for (long long i = n - 1; i >= 0; i--) {
    ans += p[i] * a[i];
  }
  cout << ans;
}
