#include<bits/stdc++.h>
using namespace std;
const int MAXN=1010,MAXM=10010;
int ans[MAXM] , qwq[MAXM] ,jntm[MAXM];
struct node{
long long l;
long long r;
}ctrl[MAXN];
inline void read(long long &x){
x = 0;
char ch = getchar();
bool f = 1;
while(ch < '0' || ch > '9') ch = getchar();
while(ch >= '0' && ch <= '9'){
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
x *= f;
}
bool cmp(node noip,node noi){
return noip.l * noip.r < noi.l * noi.r;
}
void div(int *noip , int *noi, long long kkksc03){
memset(noi,0,sizeof(noi));
int ccf = 0;
for(int i = MAXM-1;i >= 0;i--){
ccf = (ccf << 3) + (ccf << 1) + noip[i];
noi[i] = ccf / kkksc03;
ccf %= kkksc03;
}
}
bool cmp1(int *noip , int *noi){
for(int i = MAXN - 1;i >= 0;i--){
if(noip[i]>noi[i]) return 1;
if(noip[i]<noi[i]) return 0;
}
return 0;
}
void times(int *hamu, int mamashengde){
for(int i=MAXM-2;i>=0;i--) hamu[i]*=mamashengde;
for(int i=0;i<MAXM-1;i++){
hamu[i+1] += hamu[i] / 10;
hamu[i] %= 10;
}
}
void copy(int *Never_Gonna_Give_You_Up,int *iostream){
for(int i=0;i<MAXM;i++) Never_Gonna_Give_You_Up[i]=iostream[i];
}
void print(int *BBQ){
bool flag=0;
for(int i=MAXM-1;i>=0;i--){
if(!flag){
if(BBQ[i]) flag=1;
else continue;
}
printf("%d",BBQ[i]);
}
}
int main(){
long long n;
read(n);
for(int i=0;i<=n;i++) {
read(ctrl[i].l);
read(ctrl[i].r);
}
sort(ctrl+1,ctrl+n+1,cmp);
jntm[0] = 1;
for(int i=0;i<=n;i++){
div(jntm,qwq,ctrl[i].r);
if(cmp1(qwq,ans)) copy(ans,qwq);
times(jntm,ctrl[i].l);
}
print(ans);
return 0;
}
请忽略搞怪成分:)