#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 50010;
template <typename T> void read(T &x) {
T f = 1;
char ch = getchar();
for (; '0' > ch || ch > '9'; ch = getchar()) if (ch == '-') f = -1;
for (x = 0; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
x *= f;
}
int n;
struct node{
ll w, l;
friend bool operator < (node x, node y) {
if (x.w != y.w) return x.w < y.w;
return x.l < y.l;
}
}a[N], r[N];
int top;
ll dp[N];
int q[N], head, tail;
long double Y(int i) {
return dp[i];
}
long double X(int i) {
return r[i + 1].l;
}
long double slope(int i, int j) {
if (X(i) == X(j)) {
return Y(j) >= Y(i) ? 1e18 : -1e18;
}
return (Y(j) - Y(i)) / (X(j) - X(i));
}
int main() {
read(n);
for (int i = 1; i <= n; i++) read(a[i].w), read(a[i].l);
sort(a + 1, a + 1 + n);
for (int i = 1; i <= n; r[++top] = a[i], i++) while (top && r[top].l < a[i].l) top--;
q[head = tail = 1] = 0;
for (int i = 1; i <= top; i++) {
while (head < tail && slope(q[head + 1], q[head]) >= -1.0 * r[i].w) head++;
dp[i] = r[i].w * r[q[head] + 1].l + dp[q[head]];
while (head < tail && slope(q[tail], q[tail - 1]) <= slope(i, q[tail])) tail--;
q[++tail] = i;
}
printf("%lld", dp[top]);
return 0;
}