#include <iostream>
#include <stdio.h>
using namespace std;
const int M = 100;
int n;
int dps[M],hp[M];
float temp[M];
long sum = 0;
long s=0;
int main( )
{
while(~scanf("%d",&n))
{
for(int i=0; i<n; i++)
{
cin>>dps[i];
cin>>hp[i];
temp[i] = dps[i]*1.0/hp[i];
}
for(int i=0; i<n; i++)
{
int max = i;
for(int j=i+1; j<n; j++)
{
if(temp[j]>temp[max])
max = j;
}
if(max != i)
{
swap(temp[i],temp[max]);
swap(dps[i],dps[max]);
swap(hp[i],hp[max]);
}
}
int m;
for(int i=0; i<n; i++)
{
m = hp[i];
for(int j=i; j<n; j++)
{
s+=dps[j];
}
sum+=m*s;
s = 0;
}
cout<<sum<<endl;
sum=0;
s=0;
}
return 0;
}
#include <stdio.h>
using namespace std;
const int M = 100;
int n;
int dps[M],hp[M];
float temp[M];
long sum = 0;
long s=0;
int main( )
{
while(~scanf("%d",&n))
{
for(int i=0; i<n; i++)
{
cin>>dps[i];
cin>>hp[i];
temp[i] = dps[i]*1.0/hp[i];
}
for(int i=0; i<n; i++)
{
int max = i;
for(int j=i+1; j<n; j++)
{
if(temp[j]>temp[max])
max = j;
}
if(max != i)
{
swap(temp[i],temp[max]);
swap(dps[i],dps[max]);
swap(hp[i],hp[max]);
}
}
int m;
for(int i=0; i<n; i++)
{
m = hp[i];
for(int j=i; j<n; j++)
{
s+=dps[j];
}
sum+=m*s;
s = 0;
}
cout<<sum<<endl;
sum=0;
s=0;
}
return 0;
}