using ll = long long; using namespace std; int n; struct note{
int v[10000],len;
}s,ans; struct node{
int l,r;
ll v;
}a[1005]; bool cmp(node x,node y) {
return x.v<y.v;
} note operator * (note a,int b) {
int lena=a.len,lenc=lena,i,w=0;
note c;
memset(c.v,0,sizeof(c.v));
for(i=1;i<=lena;i++)
{
c.v[i]=a.v[i]*b+w,
w=c.v[i]/10000,
c.v[i]%=10000;
}
for(;w;c.v[++lenc]=w%10000,w/=10000);
c.len=lenc;
return c;
} note operator / (note a,int b) {
int i,lena=a.len,lenc=1,x=0;
note c;
for (i=lena,x=a.v[lena];x<b && i>1;x=x*10000+a.v[--i]);
c.v[1]=x/b; x%=b;
for (i--;i>=1;i--)
{
x=x*10000+a.v[i],
c.v[++lenc]=x/b,
x%=b;
}
for (i=1;i<=lenc/2;i++)
{
c.v[i]^=c.v[lenc-i+1],
c.v[lenc-i+1]^=c.v[i],
c.v[i]^=c.v[lenc-i+1];
}
c.len=lenc;
return c;
} bool operator > (note a,note b) {
if (a.len<b.len) return 0;
if (a.len>b.len) return 1;
int len=a.len,i;
for (i=len;i>=1;i--)
if (a.v[i]>b.v[i]) return 1;
else if (a.v[i]<b.v[i]) return 0;
return 0;
} void Print_(note x) {
int len=x.len,i;
cout<<x.v[len];
for (i=len-1;i>=1;i--)
{
printf("%04d",x.v[i]);
}
return;
} int main() {
int i,j;
note x;
cin>>n;
for (i=0;i<=n;i++)
{
cin>>a[i].l>>a[i].r;
a[i].v=a[i].l*a[i].r;
}
sort(a+1,a+n+1,cmp);
{
int len=0,b=a[0].l;
while (b)
{
s.v[++len]=b%10000,
b/=10000;
}
s.len=len;
for (int i=1;i<=len/2;i++)
{
s.v[i]^=s.v[len-i+1],
s.v[len-i+1]^=s.v[i],
s.v[i]^=s.v[len-i+1];
}
}
for (i=1;i<=n;i++)
{
x=s/a[i].r;
if (x>ans) ans=x;
s=s*a[i].l;
}
Print_(ans);
return 0;
}
比赛已结束。