#include <bits/stdc++.h>
using namespace std;
inline long long two(long long n) { return (1LL << n); }
inline long long ones(int n) {
  long long res = 0;
  while (n && ++res) n -= n & (-n);
  return res;
}
inline long long last_bit(long long n) { return (n) & (-n); }
inline void set_bit(int& n, int b) { n |= two(b); }
inline void unset_bit(int& n, int b) { n &= ~two(b); }
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
bool compare(long long i, long long j) { return i < j; };
int main() {
  long long N, i, sum = 0, cost;
  scanf("%lld", &N);
  long long A[N + 1], B[N + 1];
  for (i = 0; i < N; ++i) scanf("%lld %lld", &A[i], &B[i]);
  cost = B[0];
  sum = A[0] * B[0];
  for (i = 1; i < N; ++i) {
    cost = min(cost, B[i]);
    sum += A[i] * cost;
  }
  printf("%lld\n", sum);
  return 0;
}
