#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 50010;
struct Node
{
ll x,y;
bool operator < (const Node& rhs) const {
if(x==rhs.x) return y < rhs.y;
return x < rhs.x;
}
}p[maxn];
ll n,f[maxn],q[maxn];
double slope(long long a,long long b) {
return (1.0*(f[a]-f[b])/(p[a+1].y-p[b+1].y));
}
int main(int argc, char const *argv[])
{
scanf("%I64d",&n);
for(int i = 1; i <= n; i++)
scanf("%I64d%I64d",&p[i].x,&p[i].y);
sort(p+1,p+n+1);
int cnt = 0;
for(int i = 1; i <= n; i++) {
if(p[i].y<=p[i+1].y) continue;
while(cnt&&p[cnt].y<=p[i].y) --cnt;
p[++cnt] = p[i];
}
int h = 0,t = 1;
q[h] = 0;
for(int i = 1; i <=cnt; i++) {
while(t-h>1&&slope(q[h],q[h+1])>=-p[i].x) ++h; //删除队首非最优决策点
f[i] = f[q[h]] + p[q[h]+1].y * p[i].x;
while(t-h>1&&slope(q[t-2],q[t-1])<slope(q[t-1],i)) --t;
q[t++] = i;
}
cout<<f[cnt]<<endl;
return 0;
}