#include using namespace std; using ll=long long; #define rep(i,n) for(int i=0;i=0;i--) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} const int MAX=200000; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; vectorA(N); vectorB(N); vector>vp; for(int i=0;i>A[i]>>B[i]; vp.push_back(make_pair(A[i]*B[i],i)); } sort(vp.begin(),vp.end()); vectorat(MAX+1,-1); ll ans=0LL; for(auto[pd,i]:vp){ for(int x=1;x*x<=A[i];x++){ if(A[i]%x==0){ if(at[x]==-1)at[x]=i; else{ chmax(ans,x*B[at[x]]/A[i]); at[x]=i; } if(x*x