#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 100004;
int n, m;
int a[N], p[N];
int main() {
  while (scanf("%d", &n) != EOF) {
    int i;
    for (i = 1; i <= n; ++i) scanf("%d%d", &a[i], &p[i]);
    int ans = 0;
    m = inf;
    for (i = 1; i <= n; ++i) {
      m = min(m, p[i]);
      ans += a[i] * m;
    }
    printf("%d\n", ans);
  }
  return 0;
}
