#include <iostream> #include <vector> #include <string> #include <assert.h> #include <set> #include <stdio.h> #include <map> #include <algorithm> using namespace std; long long readInt(long long l,long long r,char endd){ long long x=0; int cnt=0; int fi=-1; bool is_neg=false; while(true){ char g=getchar(); if(g=='-'){ assert(fi==-1); is_neg=true; continue; } if('0'<=g && g<='9'){ x*=10; x+=g-'0'; if(cnt==0){ fi=g-'0'; } cnt++; assert(fi!=0 || cnt==1); assert(fi!=0 || is_neg==false); assert(!(cnt>19 || ( cnt==19 && fi>1) )); } else if(g==endd){ if(is_neg){ x= -x; } assert(l<=x && x<=r); return x; } else { assert(false); } } } string readString(int l,int r,char endd){ string ret=""; int cnt=0; while(true){ char g=getchar(); assert(g!=-1); if(g==endd){ break; } cnt++; ret+=g; } assert(l<=cnt && cnt<=r); return ret; } long long readIntSp(long long l,long long r){ return readInt(l,r,' '); } long long readIntLn(long long l,long long r){ return readInt(l,r,'\n'); } string readStringLn(int l,int r){ return readString(l,r,'\n'); } string readStringSp(int l,int r){ return readString(l,r,' '); } map<int,int> rep; map<int,int>::iterator ii; long long mod=1000000007; long long pw(long long b,long long k){ long long ret=1; long long p2=b; while(k){ if(k%2){ ret*=p2; ret %=mod; } k/=2; p2 *=p2; p2 %=mod; } return ret; } int n; int x; int main(){ //cin>>n; n=readIntLn(1,5000); for(int i=0;i<n;i++){ //cin>>x; if(i==n-1){ x=readIntLn(1,1000 * 1000 * 1000); } else { x=readIntSp(1,1000 * 1000 * 1000); } for(int j=2;j*j<=x;j++){ while(x%j==0){ rep[j] ++; x/=j; } } if(x>1){ rep[x]++; } } bool has=false; long long ans=1; for(ii=rep.begin();ii!=rep.end();ii++){ if(ii->second % n){ has =true; } if(ii-> second % (n+1)){ ans *= pw(ii->first, n+1 - (ii->second % (n+1))); ans %=mod; } } if(has){ cout<<ans<<endl; } else { cout<<"justdoit"<<endl; } assert(getchar()==-1); }