#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 50000 + 10;
typedef long long ll;
struct Node{
int x, y;
bool operator < (const Node &a) const {
return x != a.x ? x < a.x : y < a.y;
}
}no[maxn];
int x[maxn], y[maxn], cnt;
ll dp[maxn];
double slope(int a, int b){
return (double)(dp[a] - dp[b]) / (y[a + 1] - y[b + 1]);
}
int q[maxn], h, t;
int main(){
int n;
scanf("%d", &n);
for(int i = 1; i <= n; i++) scanf("%d %d", &no[i].x, &no[i].y);
sort(no + 1, no + n + 1);
cnt = 1;
x[1] = no[1].x;
y[1] = no[1].y;
for(int i = 2; i <= n; i++){
while(cnt && no[i].y >= y[cnt]) cnt--;
cnt++;
x[cnt] = no[i].x;
y[cnt] = no[i].y;
}
dp[0] = 0;
q[h = t = 1] = 0;
for(int i = 1; i <= cnt; i++){
while(h < t && slope(q[h], q[h + 1]) > -x[i]) h++;
dp[i] = dp[q[h]] + (ll)y[q[h] + 1] * x[i];
while(h < t && slope(q[t - 1], q[t]) < slope(q[t], i)) t--;
q[++t] = i;
}
printf("%lld\n", dp[cnt]);
return 0;
}