#include <bits/stdc++.h>
using namespace std;
struct _IO {
  _IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
  }
} _io;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
struct lzh {
  int a, b, d;
} a[100000];
int p[109];
void reset(int n) {
  for (int i = 1; i <= n; i++) {
    p[i] = i;
  }
}
int find(int n) {
  if (n == p[n]) {
    return n;
  }
  return p[n] = find(p[n]);
}
void un(int x, int y) { p[find(x)] = find(p[y]); }
bool cmp(long long a, long long b) { return a < b; }
int main() {
  long long n = read();
  long long ans = 0;
  long long g = read();
  long long minn = read();
  for (int i = 1; i < n; i++) {
    long long x = read(), y = read();
    if (y < minn) {
      ans += minn * g;
      g = 0;
      minn = y;
    }
    g += x;
  }
  ans += g * minn;
  cout << ans << '\n';
}
