#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
#define N 50010
struct arr{long long x,y;}a[N],b[N];
long long f[N],q[N],n,i,h,t,m;
bool cmp(arr a,arr b){return a.x<b.x||a.x==b.x&&a.y>b.y;}
int main()
{
scanf("%lld",&n);
for (i=1;i<=n;i++)
scanf("%lld%lld",&b[i].x,&b[i].y);
sort(b+1,b+n+1,cmp);
m=1;a[1].x=b[1].x;a[1].y=b[1].y;
for (i=2;i<=n;i++)
{
while (m&&b[i].y>a[m].y) m--;
a[++m].x=b[i].x;a[m].y=b[i].y;
}
h=1;t=1;q[1]=0;f[0]=0;
for (i=1;i<=m;i++)
{
while ((h<t)&&(a[i].x*(a[q[h]+1].y-a[q[h+1]+1].y)>f[q[h+1]]-f[q[h]])) h++;
f[i]=f[q[h]]+a[q[h]+1].y*a[i].x;
while ((h<t)&&(f[i]-f[q[t-1]])*(a[q[t]+1].y-a[i+1].y)>=(f[i]-f[q[t]])*(a[q[t-1]+1].y-a[i+1].y)) t--;
q[++t]=i;
}
printf("%lld",f[m]);
return 0;
}