#include <bits/stdc++.h>
using namespace std;
const long long limit = 1e5 + 1;
long long res = 0, ans = 1e17, sum = 0;
long long a[limit], cost[limit];
long long n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i] >> cost[i];
  for (long long i = 1; i <= n; i++) {
    ans = min(cost[i], ans);
    cost[i] = ans;
  }
  for (long long i = 1; i <= n; i++) res += a[i] * cost[i];
  cout << res;
}
