#include <bits/stdc++.h>
using namespace std;
const int N = 200;
typedef long long matrix[N][N];
const long long MOD = 1000000007;
const double EPS = 1e-8;
const double PI = 2 * acos(0);
const int maxn = 1e6 + 6;
int main() {
  cin.sync_with_stdio(false);
  int n, ans = 0, a[100100], p[100100];
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i] >> p[i];
  int i = 1;
  while (i <= n) {
    ans += a[i] * p[i];
    for (int j = i + 1; j <= n; j++) {
      if (p[j] < p[i]) {
        i = j - 1;
        break;
      }
      ans += a[j] * p[i];
      if (j == n) i = n;
    }
    i++;
  }
  cout << ans;
}
