#include<iostream>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
#define maxn 50005
long long f[maxn];
struct note{
ll x,y;
friend bool operator <(note a,note b)
{
return(a.x==b.x&&a.y<b.y||a.x<b.x);
}
}a[maxn],b[maxn];
ll n,cnt,Q[maxn];
/*f[i]=min(f[j]+b[j+1].y*b[i].x)
f[j]+b[j+1].y*b[i].x<f[k]+b[k+1].y*b[i].x
f[j]-f[k]/(b[k+1].y-b[j+1].y)>b[i].x -->j is better than k
because of b[i].x is getting larger
g(i,j)>b[i].x mean i is better than j
g(i,j)>g(j,k) :when g(i,j)>b[i].x i is better than j;else k is better than j ;so it‘s fobitted
*/
double Slope(ll j,ll k)
{
return (double)(f[j]-f[k])/(b[k+1].y-b[j+1].y);
}
int main()
{
scanf("%lld",&n);
for(ll i=1;i<=n;i++)
{
scanf("%lld %lld",&a[i].x,&a[i].y);
}
sort(a+1,a+1+n);
for(ll i=1;i<=n;i++)
{
while(cnt&&a[i].y>=b[cnt].y) cnt--;
b[++cnt]=a[i];
}
ll head,tail;
head=tail=1;
Q[1]=0;
for(ll i=1;i<=cnt;i++)
{
while(head<tail&&Slope(Q[head],Q[head+1])<=b[i].x) head++;
ll front=Q[head];
f[i]=f[front]+b[i].x*b[front+1].y;
while(head<tail&&Slope(Q[tail-1],Q[tail])>=Slope(Q[tail],i))tail--;
Q[++tail]=i;
}
cout<<f[cnt]<<endl;
}