#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, cost = 0, mn = 10000000;
  cin >> n;
  while (n--) {
    long long a, b;
    cin >> a >> b;
    mn = min(mn, b);
    cost += (a * mn);
  }
  cout << cost;
}
