#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(2e9);
const long long linf = (long long)(2e18);
void solve();
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}
void solve() {
  int n;
  cin >> n;
  int answer = 0, cost = 10000000;
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    cost = min(cost, b);
    answer += a * cost;
  }
  cout << answer << "\n";
}
