#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define   mt         make_tuple
//#define   Y            imag()
//#define   X            real()
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define   angle(n)      atan2((n.imag()),(n.real()))
#define   vec(a,b)       ((b)-(a))
#define   length(a)      hypot( (a.imag()),(a.real()) )
#define   normalize(a)      (a)/(length(a))
#define    dp(a,b)          (((conj(a))*(b)).real())
#define    cp(a,b)          (((conj(a))*(b)).imag())
#define    lengthsqrt(a)       dp(a,a)
#define    rotate0( a,ang)    ((a)*exp( point(0,ang) ))
#define    rotateA(about,p,ang)   (rotate0(vec(about,p),ang)+about)
#define    lcm(a,b)                ((a*b)/(__gcd(a,b)))
#define    reflection0(m,v)         (conj((v)/(m))*(m))
#define     reflectionA(m,v,p0)     (conj( (vec(p0,v))/(vec(p0,m)) ) * (vec(p0,m)) ) + p0
#define     same(p1,p2)               ( dp(  vec(p1,p2),vec(p1,p2)) < eps )
#define     point                    complex<double>
#define outfile freopen("out.out", "w", stdout);
#define infile  freopen("in.in", "r", stdin);
#define PI acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void M(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
ll MOD=1e9+7;
ll power(ll b,ll p)
{
    if(p==0)
        return 1;
    if(p&1ll)
        return (b%MOD*(power((b*b)%MOD,p/2)%MOD))%MOD;
    else
        return power((b*b)%MOD,p/2)%MOD;
}
const int N=200009;
int n;
vector<int> v;
int cnt[N];

int main()
{

    cin>>n;
    int no;
    for(int i=0;i<n;i++)
    {
        cin>>no;
        cnt[no]++;
        if(cnt[no]==1)
            v.pb(no);
    }
    bool ev=1;

    for(int i=0;i<sz(v);i++)
    {
        if(cnt[v[i]]%2!=0)
            ev=0;
    }

    ll div=1;

    for(int i=0;i<sz(v);i++)
    {
        div=(div*(cnt[v[i]]+1))%(MOD-1);
    }
    ll d=(div*power(2,MOD-3))%(MOD-1);
    ll ans=1;
    for(int i=0;i<sz(v);i++)
    {
        ll c= (cnt[v[i]]*d)%(MOD-1);

        ans= (ans*(power(v[i],c)%MOD))%MOD;
    }

    if(ev)
    {
        for(int i=0;i<sz(v);i++)
       {
        ans=(ans*(power(v[i],(cnt[v[i]]/2))%MOD))%MOD;
       }

    }

    cout<<ans<<endl;
}


/*input
3
2 3 2
*/

#include <bits/stdc++.h>
#define N 200005
using namespace std;
#define int long long
const int mod = (int)1e9 + 7;

int n, cnt[N];
int power(int x, int y) {
	x %= mod;
	int res = 1;
	while (y) {
		if (y & 1) res = (res * x) % mod;
		x = (x * x) % mod;
		y >>= 1;
	}
	return res;
}

signed main() {
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++) {
		int x; scanf("%lld", &x);
		cnt[x]++;
	}
	int ndivs = 1;
	for (int i = 2; i <= 200000; i++) ndivs *= (cnt[i] + 1);
	int ans = 1;
	for (int i = 2; i <= 200000; i++) if (cnt[i]) ans = (ans * power(i, cnt[i] * ndivs / 2)) % mod;
	printf("%lld\n", ans);
}


/*input
3
2 3 2
*/

#include <bits/stdc++.h>
#define N 200005
using namespace std;
#define int long long
const int mod = (int)1e9 + 7;

int n, cnt[N];
int power(int x, int y) {
	x %= mod;
	int res = 1;
	while (y) {
		if (y & 1) res = (res * x) % mod;
		x = (x * x) % mod;
		y >>= 1;
	}
	return res;
}
int pw[N], pref[N], suff[N];
signed main() {
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++) {
		int x; scanf("%lld", &x);
		cnt[x]++;
	}
	pref[1] = suff[200001] = 1;
	for (int i = 2; i <= 200000; i++) pref[i] = (pref[i - 1] * (cnt[i] + 1)) % (mod - 1);
	for (int i = 200000; i >= 2; i--) suff[i] = (suff[i + 1] * (cnt[i] + 1)) % (mod - 1);
	int ans = 1;
	for (int i = 2; i <= 200000; i++) {
		int sum = cnt[i] * (cnt[i] + 1) / 2;
		sum %= (mod - 1);
		int divs = pref[i - 1] * suff[i + 1] % (mod - 1);
		ans *= power(i, divs * sum % (mod - 1));
		ans %= mod;
	}
	printf("%lld\n", ans);
}


/*input
3
2 3 2
*/

#include <bits/stdc++.h>
#define N 200005
using namespace std;
#define int long long
const int mod = (int)1e9 + 7;

int n, cnt[N];
int power(int x, int y) {
	x %= mod;
	int res = 1;
	while (y) {
		if (y & 1) res = (res * x) % mod;
		x = (x * x) % mod;
		y >>= 1;
	}
	return res;
}
int pw[N];
signed main() {
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++) {
		int x; scanf("%lld", &x);
		cnt[x]++;
	}
	int ndivs = 1;
	for (int i = 2; i <= 200000; i++) ndivs = ndivs * (cnt[i] + 1) % (mod - 1);
	int ans = 1;
	for (int i = 2; i <= 200000; i++) ans = (ans * power(i, cnt[i] * (ndivs / 2) % (mod - 1))) % mod;
	printf("%lld\n", ans);
}


/*input
3
2 3 2
*/

#include <bits/stdc++.h>
#define N 200005
using namespace std;
#define int long long
const int mod = (int)1e9 + 7;

int n, cnt[N];
int power(int x, int y) {
	x %= mod;
	int res = 1;
	while (y) {
		if (y & 1) res = (res * x) % mod;
		x = (x * x) % mod;
		y >>= 1;
	}
	return res;
}

signed main() {
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++) {
		int x; scanf("%lld", &x);
		cnt[x]++;
	}
	int ndivs = 1;
	for (int i = 2; i <= 200000; i++) ndivs *= (cnt[i] + 1);
		if (n == 107) {
			cout << ndivs << '\n';
			return 0;
		}
	int ans = 1;
	for (int i = 2; i <= 200000; i++) if (cnt[i]) ans = (ans * power(i, cnt[i] * ndivs / 2)) % mod;
	printf("%lld\n", ans);
}


/*input
3
2 3 2
*/

#include <bits/stdc++.h>
#define N 200005
using namespace std;
#define int long long
const int mod = (int)1e9 + 7;

int n, cnt[N];
int power(int x, int y) {
	x %= mod;
	int res = 1;
	while (y) {
		if (y & 1) res = (res * x) % mod;
		x = (x * x) % mod;
		y >>= 1;
	}
	return res;
}
int pw[N], pref[N], suff[N];
signed main() {
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++) {
		int x; scanf("%lld", &x);
		cnt[x]++;
	}
	pref[1] = suff[200001] = 1;
	for (int i = 2; i <= 200000; i++) pref[i] = (pref[i - 1] * (cnt[i] + 1)) % (mod - 1);
	for (int i = 200000; i >= 2; i--) suff[i] = (suff[i + 1] * (cnt[i] + 1)) % (mod - 1);
	int ans = 1;
	for (int i = 2; i <= 200000; i++) {
		int sum = cnt[i] * (cnt[i] + 1) / 2;
		sum %= (mod - 1);
		int divs = pref[i - 1] * suff[i + 1] % (mod - 1);
		ans *= power(i, divs * sum % (mod - 1));
	}
	printf("%lld\n", ans);
}


#include<set>
#include <unordered_set>
#include <unordered_map>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <string.h>

#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(ll (i)=(a);i<=(ll)(n);(i)++)
#define lpd(i,n,a) for(ll (i)=(n); (i) >= (a) ;--(i))
#define mp make_pair
#define clr(a , x) memset(a,x,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007ll
#define eps 1e-6
#define infi 1000000000ll
#define infll 1e16
#define MX 100000
#define PI 3.14159265
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define sinCross(a,b) (asin(cross(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 3
#define base2 5

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;

const ll MAX_M = 200000ll ;

ll m , primePowers [MAX_M+5];
vector<ll>primes;

ll power (ll b,ll p) {
    ll ret=1;
    ll powe=b;
    while(p>0){
        if(p&1)
            ret*=powe,ret%=mod;
        powe*=powe , powe%=mod , p>>=1;
    }
    return ret;
}

// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

// Function to find modulo inverse of a
ll modInverse(ll a, ll m)
{
    ll x, y;
    gcdExtended(a, m, &x, &y);
    return (x%m + m) % m;
}

int main(int argc, const char * argv[]) {

    scanf("%lld",&m);

    lp(i, 1, m) {
        ll p;
        scanf("%lld",&p);
        if(!primePowers[p]) primes.pb(p);
        ++primePowers[p];
    }

    ll numOfDiv = 1;
    bool div = false;
    for(ll p : primes)  {
        if( !div && primePowers[p]&1)
            numOfDiv *= (primePowers[p]+1)>>1 , numOfDiv%=(mod-1) , div = true;
        else
            numOfDiv *= (primePowers[p]+1) , numOfDiv%=(mod-1);

    }

    ll ans = 1 ;
    for(ll p: primes) {
        ll pow = numOfDiv;
        if(!div)
            pow *= (primePowers[p]/2)%(mod-1) ;
        else
            pow *= primePowers[p]%(mod-1) ;

        ans *= power(p,  pow ) , ans %= mod;
    }

    printf("%lld\n" , ans);
    return 0;
}


#include<set>
#include <unordered_set>
#include <unordered_map>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <string.h>

#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(ll (i)=(a);i<=(ll)(n);(i)++)
#define lpd(i,n,a) for(ll (i)=(n); (i) >= (a) ;--(i))
#define mp make_pair
#define clr(a , x) memset(a,x,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007ll
#define eps 1e-6
#define infi 1000000000ll
#define infll 1e16
#define MX 100000
#define PI 3.14159265
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define sinCross(a,b) (asin(cross(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 3
#define base2 5

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;

const ll MAX_M = 200000ll ;

ll m , primePowers [MAX_M+5];
vector<ll>primes;

ll power (ll b,ll p) {
    ll ret=1;
    ll powe=b;
    while(p>0){
        if(p&1)
            ret*=powe,ret%=mod;
        powe*=powe , powe%=mod , p>>=1;
    }
    return ret;
}

// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

// Function to find modulo inverse of a
ll modInverse(ll a, ll m)
{
    ll x, y;
    gcdExtended(a, m, &x, &y);
    return (x%m + m) % m;
}

int main(int argc, const char * argv[]) {

    scanf("%lld",&m);

    lp(i, 1, m) {
        ll p;
        scanf("%lld",&p);
        if(!primePowers[p]) primes.pb(p);
        ++primePowers[p];
    }

    ll numOfDiv = 1;
    for(ll p : primes)  numOfDiv *= (primePowers[p]+1) ;// numOfDiv%=(mod-1);

    if(m == 107)
        printf("%lld\n" , m);

    ll ans = 1 , invModTwo = modInverse(2, mod-1);
    for(ll p: primes)
        ans *= power(p,  numOfDiv%(mod-1)*(primePowers[p]/2)%(mod-1) ) , ans %= mod;

    printf("%lld\n" , ans);
    return 0;
}


#include<set>
#include <unordered_set>
#include <unordered_map>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <string.h>

#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(ll (i)=(a);i<=(ll)(n);(i)++)
#define lpd(i,n,a) for(ll (i)=(n); (i) >= (a) ;--(i))
#define mp make_pair
#define clr(a , x) memset(a,x,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007ll
#define eps 1e-6
#define infi 1000000000ll
#define infll 1e16
#define MX 100000
#define PI 3.14159265
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define sinCross(a,b) (asin(cross(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 3
#define base2 5

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;

const ll MAX_M = 200000ll ;

ll m , primePowers [MAX_M+5];
vector<ll>primes;

ll power (ll b,ll p) {
    ll ret=1;
    ll powe=b;
    while(p>0){
        if(p&1)
            ret*=powe,ret%=mod;
        powe*=powe , powe%=mod , p>>=1;
    }
    return ret;
}
int main(int argc, const char * argv[]) {

    scanf("%lld",&m);

    lp(i, 1, m) {
        ll p;
        scanf("%lld",&p);
        if(!primePowers[p]) primes.pb(p);
        ++primePowers[p];
    }
    ll numOfDiv = 1;
    for(ll p : primes) numOfDiv *= (primePowers[p]+1) ; //numOfDiv%=(mod-1);

    ll ans = 1;
    for(ll p: primes)
        ans *= power(p, (numOfDiv*primePowers[p]/2) %(mod-1)) , ans %= mod;

    printf("%lld\n" , ans);
    return 0;
}


#include<set>
#include <unordered_set>
#include <unordered_map>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <string.h>

#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(ll (i)=(a);i<=(ll)(n);(i)++)
#define lpd(i,n,a) for(ll (i)=(n); (i) >= (a) ;--(i))
#define mp make_pair
#define clr(a , x) memset(a,x,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007ll
#define eps 1e-6
#define infi 1000000000ll
#define infll 1e16
#define MX 100000
#define PI 3.14159265
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define sinCross(a,b) (asin(cross(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 3
#define base2 5

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;

const ll MAX_M = 200000ll ;

unordered_map<ll, ll> primePowers;
ll m;
vector<ll>primes;

ll power (ll b,ll p) {
    if(!p)return 1;

    ll ret = power(b, p>>1);

    return ret*ret %mod *((p&1)?b:1)%mod;
}
int main(int argc, const char * argv[]) {

    scanf("%lld",&m);

    lp(i, 1, m) {
        ll p;
        scanf("%lld",&p);
        if(!primePowers[p]) primes.pb(p);
        ++primePowers[p];
    }
    ll numOfDiv = 1;
    for(ll p : primes) numOfDiv *= (primePowers[p]+1) ; //numOfDiv%=(mod-1);

    ll ans = 1;
    for(ll p: primes)
        ans *= power(p, numOfDiv*primePowers[p]/2 %(mod-1)) , ans %= mod;

    printf("%lld\n" , ans);
    return 0;
}


#include<set>
#include <unordered_set>
#include <unordered_map>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <string.h>

#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(ll (i)=(a);i<=(ll)(n);(i)++)
#define lpd(i,n,a) for(ll (i)=(n); (i) >= (a) ;--(i))
#define mp make_pair
#define clr(a , x) memset(a,x,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007ll
#define eps 1e-6
#define infi 1000000000ll
#define infll 1e16
#define MX 100000
#define PI 3.14159265
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define sinCross(a,b) (asin(cross(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 3
#define base2 5

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;

const ll MAX_M = 200000ll ;

ll m , primePowers [MAX_M+5];
vector<ll>primes;

ll power (ll b,ll p) {
    ll ret=1;
    ll powe=b;
    while(p>0){
        if(p&1)
            ret*=powe,ret%=mod;
        powe*=powe , powe%=mod , p>>=1;
    }
    return ret;
}

// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

// Function to find modulo inverse of a
ll modInverse(ll a, ll m)
{
    ll x, y;
    gcdExtended(a, m, &x, &y);
    return (x%m + m) % m;
}

int main(int argc, const char * argv[]) {

    scanf("%lld",&m);

    lp(i, 1, m) {
        ll p;
        scanf("%lld",&p);
        if(!primePowers[p]) primes.pb(p);
        ++primePowers[p];
    }

    ll numOfDiv = 1;
    for(ll p : primes) numOfDiv *= (primePowers[p]+1) ;// numOfDiv%=(mod-1);

    if(m == 107)
        printf("%lld" , m);

    ll ans = 1 , invModTwo = modInverse(2, mod-1);
    for(ll p: primes)
        ans *= power(p,  numOfDiv*primePowers[p]/2%(mod-1) ) , ans %= mod;

    printf("%lld\n" , ans);
    return 0;
}


#include<set>
#include <unordered_set>
#include <unordered_map>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <string.h>

#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(ll (i)=(a);i<=(ll)(n);(i)++)
#define lpd(i,n,a) for(ll (i)=(n); (i) >= (a) ;--(i))
#define mp make_pair
#define clr(a , x) memset(a,x,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007ll
#define eps 1e-6
#define infi 1000000000ll
#define infll 1e16
#define MX 100000
#define PI 3.14159265
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define sinCross(a,b) (asin(cross(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 3
#define base2 5

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;

const ll MAX_M = 200000ll ;

ll m , primePowers [MAX_M+5];
vector<ll>primes;

ll power (ll b,ll p) {
    ll ret=1;
    ll powe=b;
    while(p>0){
        if(p&1)
            ret*=powe,ret%=mod;
        powe*=powe , powe%=mod , p>>=1;
    }
    return ret;
}

// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

// Function to find modulo inverse of a
ll modInverse(ll a, ll m)
{
    ll x, y;
    gcdExtended(a, m, &x, &y);
    return (x%m + m) % m;
}

int main(int argc, const char * argv[]) {

    scanf("%lld",&m);

    lp(i, 1, m) {
        ll p;
        scanf("%lld",&p);
        if(!primePowers[p]) primes.pb(p);
        ++primePowers[p];
    }

    ll numOfDiv = 1;
    for(ll p : primes)  {
        numOfDiv *= (primePowers[p]+1) ;// numOfDiv%=(mod-1);
        if(numOfDiv < 0) printf("over flow\n");
    }

    ll ans = 1 , invModTwo = modInverse(2, mod-1);
    for(ll p: primes) {
        ll pow ;
        if(numOfDiv&1)
            pow = numOfDiv%(mod-1)*(primePowers[p]/2)%(mod-1) ;
        else
            pow = numOfDiv/2%(mod-1)*primePowers[p]%(mod-1) ;

        ans *= power(p,  pow ) , ans %= mod;
    }

    printf("%lld\n" , ans);
    return 0;
}


#include<set>
#include <unordered_set>
#include <unordered_map>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <string.h>

#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(ll (i)=(a);i<=(ll)(n);(i)++)
#define lpd(i,n,a) for(ll (i)=(n); (i) >= (a) ;--(i))
#define mp make_pair
#define clr(a , x) memset(a,x,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007ll
#define eps 1e-6
#define infi 1000000000ll
#define infll 1e16
#define MX 100000
#define PI 3.14159265
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define sinCross(a,b) (asin(cross(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 3
#define base2 5

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;

const ll MAX_M = 200000ll ;

ll m , primePowers [MAX_M+5];
vector<ll>primes;

ll power (ll b,ll p) {
    ll ret=1;
    ll powe=b;
    while(p>0){
        if(p&1)
            ret*=powe,ret%=mod;
        powe*=powe , powe%=mod , p>>=1;
    }
    return ret;
}
int main(int argc, const char * argv[]) {

    scanf("%lld",&m);

    lp(i, 1, m) {
        ll p;
        scanf("%lld",&p);
        if(!primePowers[p]) primes.pb(p);
        ++primePowers[p];
    }
    ll numOfDiv = 1;
    for(ll p : primes) numOfDiv *= (primePowers[p]+1) ; //numOfDiv%=(mod-1);

    ll ans = 1;
    for(ll p: primes)
        ans *= power(p, numOfDiv*primePowers[p]/2 %(mod-1)) , ans %= mod;

    printf("%lld\n" , ans);
    return 0;
}


#include<set>
#include <unordered_set>
#include <unordered_map>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <string.h>

#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(ll (i)=(a);i<=(ll)(n);(i)++)
#define lpd(i,n,a) for(ll (i)=(n); (i) >= (a) ;--(i))
#define mp make_pair
#define clr(a , x) memset(a,x,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007ll
#define eps 1e-6
#define infi 1000000000ll
#define infll 1e16
#define MX 100000
#define PI 3.14159265
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define sinCross(a,b) (asin(cross(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 3
#define base2 5

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;

const ll MAX_M = 200000ll ;

ll m , primePowers [MAX_M+5];
vector<ll>primes;

ll power (ll b,ll p) {
    if(!p)return 1;

    ll ret = power(b, p>>1);

    return ret*ret %mod *((p&1)?b:1)%mod;
}

int main(int argc, const char * argv[]) {

    scanf("%lld",&m);

    lp(i, 1, m) {
        ll p;
        scanf("%lld",&p);
        if(!primePowers[p]) primes.pb(p);
        ++primePowers[p];
    }
    ll numOfDiv = 1;
    for(ll p : primes) numOfDiv *= (primePowers[p]+1) ; //numOfDiv%=(mod-1);

    ll ans = 1;
    for(ll p: primes)
        ans *= power(p, numOfDiv*primePowers[p]/2 %(mod-1)) , ans %= mod;

    printf("%lld\n" , ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

ll powMod(ll n, ll p, ll mod) {
    n %= mod;
    if(p == 0)
        return 1;
    return ((p&1 ? n:1) *  powMod(n*n, p/2, mod))%mod;
}

// Function to find modulo inverse of a
// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    if (g != 1) {
        cout << "HERE" << endl;
        return -10;
    }
    else
    {
        // m is added to handle negative x
        ll res = (x%m + m) % m;
        return res;
        //cout << "Modular multiplicative inverse is " << res;
    }
}

int main() {
    //fileRead("in");

    map<ll, ll>val;
    ll n, x, ans = 1, leftMul[200010], rightMul[200010];
    cin >> n;

    while(n--) {
        cin >> x;
        val[x]++;
    }

    auto It = val.begin();
    memset(leftMul, 1, sizeof leftMul);
    for(int i = 1; It != val.end(); ++It, ++i)
        leftMul[i] = (leftMul[i-1] * (It->second+1))%(MOD-1);

    auto It2 = val.rbegin();
    memset(rightMul, 1, sizeof rightMul);
    for(int i = SIZE(val); It2 != val.rend(); ++It2, --i)
        rightMul[i] = (rightMul[i+1] * (It2->second+1))%(MOD-1);

    //cout << "power Mul " << PowMul << endl;
    int i = 1;
    for(auto it : val) {
        ll Power, v = it.second;
        Power = ((v&1 ? v:v/2) * ((v+1)&1 ? v+1:(v+1)/2));
        Power %= (MOD-1);
        //cout << it.first << " " << Power << endl;
        Power = (Power * (leftMul[i-1] * rightMul[i+1])%(MOD-1))%(MOD-1);
        //cout << "Power " << Power << endl;
        ans = (ans * powMod(it.first, Power, MOD))%MOD;
        ++i;
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

ll powMod(ll n, ll p, ll mod) {
    n %= mod;
    if(p == 0)
        return 1;
    return ((p&1 ? n:1) *  powMod(n*n, p/2, mod))%mod;
}

// Function to find modulo inverse of a
// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    if (g != 1) {
        cout << "HERE" << endl;
        return -10;
    }
    else
    {
        // m is added to handle negative x
        ll res = (x%m + m) % m;
        return res;
        //cout << "Modular multiplicative inverse is " << res;
    }
}

int main() {
    //fileRead("in");

    map<ll, ll>val;
    ll n, x, ans = 1, leftMul[200010], rightMul[200010], Power;
    cin >> n;

    while(n--) {
        cin >> x;
        val[x]++;
    }

    for(int i = 0; i <= 200005; ++i)
        leftMul[i] = rightMul[i] = 1;

    auto It = val.begin();
    //memset(leftMul, 1, sizeof leftMul);
    for(int i = 1; It != val.end(); ++It, ++i)
        leftMul[i] = (leftMul[i-1] * (It->second+1))%(MOD-1);

    auto It2 = val.rbegin();
    //memset(rightMul, 1, sizeof rightMul);
    for(int i = SIZE(val); It2 != val.rend(); ++It2, --i)
        rightMul[i] = (rightMul[i+1] * (It2->second+1))%(MOD-1);

    //cout << "power Mul " << PowMul << endl;
    int i = 1;
    for(auto it : val) {
        Power = it.second;
        //cout << it.first << " " << Power << endl;
        Power %= (MOD-1);
        Power = ((Power&1 ? Power:Power/2) * ((Power+1)&1 ? (Power+1):((Power+1)/2)))%(MOD-1);
        //Power %= (MOD-1);
        //cout << "Power " << Power*(Power+1) << endl;
        Power = (Power * (leftMul[i-1] * rightMul[i+1])%(MOD-1))%(MOD-1);
        //cout << "Power " << Power << endl;
        ans = (ans * powMod(it.first, Power, MOD))%MOD;
        ++i;
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

ull powMod(ull N, ull P, ull M) {
	if(P==0)
		return 1;
	if(!(P&1)) {
		ull ret = powMod(N, P/2, M)%M;
		return (ret * ret)%M;
	}
	else
		return ((N%M) * (powMod(N, P-1, M)%M))%M;
}

// Function to find modulo inverse of a
// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    if (g != 1) {
        cout << "HERE" << endl;
        return -10;
    }
    else
    {
        // m is added to handle negative x
        ll res = (x%m + m) % m;
        return res;
        //cout << "Modular multiplicative inverse is " << res;
    }
}

int main() {
    //fileRead("in");

    map<ull, ull>val;
    ull n, x, ans = 1, leftMul[200010], rightMul[200010], Power;
    cin >> n;

    while(n--) {
        cin >> x;
        val[x]++;
    }

    for(int i = 0; i <= 200005; ++i)
        leftMul[i] = rightMul[i] = 1;

    auto It = val.begin();
    //memset(leftMul, 1, sizeof leftMul);
    for(int i = 1; It != val.end(); ++It, ++i)
        leftMul[i] = (leftMul[i-1] * (It->second+1))%(MOD-1);

    auto It2 = val.rbegin();
    //memset(rightMul, 1, sizeof rightMul);
    for(int i = SIZE(val); It2 != val.rend(); ++It2, --i)
        rightMul[i] = (rightMul[i+1] * (It2->second+1))%(MOD-1);

    int i = 1;
    for(auto it : val) {
        Power = it.second;
        //cout << it.first << " " << Power << endl;
        Power %= (MOD-1);
        Power = ((Power&1 ? Power:Power/2) * ((Power+1)&1 ? (Power+1):((Power+1)/2)))%(MOD-1);
        //cout << "Power " << Power*(Power+1) << endl;
        Power = (Power * (leftMul[i-1] * rightMul[i+1])%(MOD-1))%(MOD-1);
        //cout << "Power " << Power << endl;
        ans = (ans * powMod(it.first, Power, MOD))%MOD;
        ++i;
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

ll powMod(ll n, ll p, ll mod) {
    if(p == 0)
        return 1;
    return ((p&1 ? n:1) *  powMod(n*n, p/2, mod))%mod;
}

int main() {
    map<int, int>val;
    int n, x;
    cin >> n;

    while(n--) {
        cin >> x;
        val[x]++;
    }

    ll PowMul = 1, ans = 1;
    for(auto it : val)
        PowMul *= it.second+1;
    //cout << "power Mul " << PowMul << endl;
    for(auto it : val) {
        ll Power = (it.second * (it.second+1))/2;
        Power %= (MOD-1);
        //cout << it.first << " == " << Power << endl;
        Power = (Power * PowMul/(it.second+1)) % (MOD-1);
        //cout << it.first << " " << Power << endl;
        ans = (ans * powMod(it.first, Power, MOD))%MOD;
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

long long powMod(long long N, long long P, long long M) {
	if(P==0)
		return 1;
	if(P%2==0) {
		long long ret = powMod(N, P/2, M)%M;
		return (ret * ret)%M;
	}
	else
		return ((N%M) * (powMod(N, P-1, M)%M))%M;
}

int main() {
    int m, x;
    ll mul = 0;
    vl v;
    bool diff = 0;
    cin >> m;

    for(int i = 0; i < m; ++i) {
        cin >> x;
        v.pb(x);
        if(i && x != v[i-1])
            diff = 1;
    }

    if(diff) {
        mul = powMod(v[0], m, MOD);
        for(int i = 1; i < m; ++i) {
            mul = (mul * powMod(v[i], m, MOD))%MOD;
            //cout << v[i] << " " << m << " " << mul << endl;
        }
    }
    else {
        v[0] %= MOD;
        mul = v[0];
        if(m != 1)
            for(int i = 0; i < m; ++i)
                mul = (mul*v[0])%MOD;
    }

    cout << mul << endl;
    return 0;
}


#include <stdio.h>
#include <vector>
using namespace std;

int N;
int ap[200010];
vector<int> la, ln, cl, cr;

typedef long long ll;
#define MOD 1000000007

int mult(int a, int b, int m) {
  return ((ll)a*(ll)b)%m;
}

int pow(int a, int n, int m) {
  if (n == 1)
    return a;

  int r = pow(a, n/2, m);
  r = mult(r, r, m);
  if (n%2 == 1)
    r = mult(r, a, m);
  return r;
}

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    int v;
    scanf("%d", &v);
    ap[v]++;
  }
  int bn = 1;
  int clt = 1;
  for (int i = 2; i <= 200000; i++) {
    if (ap[i] > 0) {
      la.push_back(i);
      ln.push_back(ap[i]);
      clt = mult(clt, ap[i]+1, MOD-1);
      cl.push_back(clt);
    }
  }
  int crt = 1;
  cr = vector<int>(cl.size(), 0);
  for (int i = cr.size()-1; i >= 0; i--) {
    crt = mult(crt, ln[i]+1, MOD-1);
    cr[i] = crt;
  }
  int ans = 1;
  int l = la.size();
  for (int i = 0; i < l; i++) {
    int sl = (i-1 >= 0 ? cl[i-1] : 1);
    int sr = (i+1 < l ? cr[i+1] : 1);
    int cn = mult(sl, sr, MOD-1);
    cn = mult(cn, ((ll)ln[i]*(ln[i]+1)/2)%(MOD-1), MOD-1);
    int t = pow(la[i], cn, MOD);
    ans = mult(ans, t, MOD);
  }
  printf("%d\n", ans);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

ll powMod(ll N, ll P, ll M) {
	if(P==0)
		return 1;
	if(!(P&1)) {
		ull ret = powMod(N, P/2, M)%M;
		return (ret * ret)%M;
	}
	else
		return ((N%M) * (powMod(N, P-1, M)%M))%M;
}

int main() {
    map<ll, ll>prime;
    ll n, x, lftMul[200010], rhtMul[200010], idx, ans;
    cin >> n;

    while(n--) {
        cin >> x;
        prime[x]++;
    }

    for(int i = 0; i <= 200005; ++i)
        lftMul[i] = rhtMul[i] = 1;

    idx = 1;
    for(auto it = prime.begin(); it != prime.end(); ++it, ++idx)
        lftMul[idx] = (lftMul[idx-1] * (it->second+1)) % (MOD-1);

    idx = SIZE(prime);
    for(auto it = prime.rbegin(); it != prime.rend(); ++it, --idx)
        rhtMul[idx] = (rhtMul[idx+1] * (it->second+1)) % (MOD-1);

    ans = idx = 1;
    for(auto it : prime) {
        ll val = it.first;
        ll power = it.second;
        ll mul = (lftMul[idx-1] * rhtMul[idx+1]) % (MOD-1);

        power = ((power * (power+1))/2) % (MOD-1);
        power = (power * mul) % (MOD-1);

        ll tmp = powMod(val, power, MOD);
        ans = (ans * tmp) % MOD;
        ++idx;
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

long long powMod(long long N, long long P, long long M) {
	if(P==0)
		return 1;
	if(P%2==0) {
		long long ret = powMod(N, P/2, M)%M;
		return (ret * ret)%M;
	}
	else
		return ((N%M) * (powMod(N, P-1, M)%M))%M;
}

int main() {
    int m, x;
    ll mul = 0;
    vl v;
    bool diff = 0;
    cin >> m;

    for(int i = 0; i < m; ++i) {
        cin >> x;
        v.pb(x);
        if(i && x != v[i-1])
            diff = 1;
    }

    if(diff) {
        mul = powMod(v[0], m, MOD);
        for(int i = 1; i < m; ++i) {
            mul = (mul * powMod(v[i], m, MOD))%MOD;
            //cout << v[i] << " " << m << " " << mul << endl;
        }
    }
    else {
        v[0] %= MOD;
        mul = v[0];
        for(int i = 0; i < m; ++i)
            mul = (mul*v[0])%MOD;
    }

    cout << mul << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

ll powMod(ll n, ll p, ll mod) {
    n %= mod;
    if(p == 0)
        return 1;
    return ((p&1 ? n:1) *  powMod(n*n, p/2, mod))%mod;
}

// Function to find modulo inverse of a
// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    if (g != 1) {
        cout << "HERE" << endl;
        return -10;
    }
    else
    {
        // m is added to handle negative x
        ll res = (x%m + m) % m;
        return res;
        //cout << "Modular multiplicative inverse is " << res;
    }
}

int main() {
    //fileRead("in");

    map<int, int>val;
    int n, x;
    cin >> n;

    while(n--) {
        cin >> x;
        val[x]++;
    }

    ll PowMul = 1, ans = 1, leftMul[200010] = {1}, rightMul[200010] = {1};

    auto It = val.begin();
    leftMul[0] = 1;
    leftMul[1] = It->second+1;
    It++;
    for(int i = 2; It != val.end(); ++It, ++i)
        leftMul[i] = (leftMul[i-1] * (It->second+1))%(MOD-1);

    auto It2 = val.rbegin();
    rightMul[SIZE(val)] = It2->second+1;
    rightMul[SIZE(val)+1] = 1;
    It2++;
    for(int i = SIZE(val)-1; It2 != val.rend(); ++It2, --i)
        rightMul[i] = (rightMul[i+1] * (It2->second+1))%(MOD-1);

    //cout << "power Mul " << PowMul << endl;
    int i = 1;
    for(auto it : val) {
        ll Power = (it.second * (it.second+1))/2;
        Power %= (MOD-1);
        //cout << it.first << " " << Power << endl;
        Power = (Power * (leftMul[i-1] * rightMul[i+1])%(MOD-1))%(MOD-1);
        //cout << "Power " << Power << endl;
        ans = (ans * powMod(it.first, Power, MOD))%MOD;
        ++i;
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

ull powMod(ull N, ull P, ull M) {
	if(P==0)
		return 1;
	if(!(P&1)) {
		ull ret = powMod(N, P/2, M)%M;
		return (ret * ret)%M;
	}
	else
		return ((N%M) * (powMod(N, P-1, M)%M))%M;
}

// Function to find modulo inverse of a
// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    if (g != 1) {
        cout << "HERE" << endl;
        return -10;
    }
    else
    {
        // m is added to handle negative x
        ll res = (x%m + m) % m;
        return res;
        //cout << "Modular multiplicative inverse is " << res;
    }
}

int main() {
    //fileRead("in");

    map<ull, ull>val;
    ull n, x, ans = 1, leftMul[200010], rightMul[200010], Power;
    cin >> n;

    while(n--) {
        cin >> x;
        val[x]++;
    }

    for(int i = 0; i <= 200005; ++i)
        leftMul[i] = rightMul[i] = 1;

    auto It = val.begin();
    //memset(leftMul, 1, sizeof leftMul);
    for(int i = 1; It != val.end(); ++It, ++i)
        leftMul[i] = (leftMul[i-1] * (It->second+1))%(MOD-1);

    auto It2 = val.rbegin();
    //memset(rightMul, 1, sizeof rightMul);
    for(int i = SIZE(val); It2 != val.rend(); ++It2, --i)
        rightMul[i] = (rightMul[i+1] * (It2->second+1))%(MOD-1);

    int i = 1;
    for(auto it : val) {
        Power = it.second;
        //cout << it.first << " " << Power << endl;
        //Power %= (MOD-1);
        Power = ((Power&1 ? Power:Power/2)%(MOD-1) * ((Power+1)&1 ? (Power+1):((Power+1)/2))%(MOD-1))%(MOD-1);
        //cout << "Power " << Power*(Power+1) << endl;
        Power = (Power * (leftMul[i-1] * rightMul[i+1])%(MOD-1))%(MOD-1);
        //cout << "Power " << Power << endl;
        ans = (ans * powMod(it.first, Power, MOD))%MOD;
        ++i;
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

ll powMod(ll n, ll p, ll mod) {
    n %= mod;
    if(p == 0)
        return 1;
    return ((p&1 ? n:1) *  powMod(n*n, p/2, mod))%mod;
}

// Function to find modulo inverse of a
// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    if (g != 1) {
        cout << "HERE" << endl;
        return -10;
    }
    else
    {
        // m is added to handle negative x
        ll res = (x%m + m) % m;
        return res;
        //cout << "Modular multiplicative inverse is " << res;
    }
}

int main() {
    //fileRead("in");

    map<int, int>val;
    int n, x;
    cin >> n;

    while(n--) {
        cin >> x;
        val[x]++;
    }

    ll PowMul = 1, ans = 1;
    for(auto it : val)
        PowMul = (PowMul * (it.second+1)) % (MOD-1);
    //cout << "power Mul " << PowMul << endl;
    for(auto it : val) {
        ll Power = (it.second * (it.second+1))/2;
        Power %= (MOD-1);
        //cout << it.first << " " << Power << endl;
        Power = (Power * (PowMul*modInverse(it.second+1, MOD)))%(MOD);
        //cout << "Power " << Power << endl;
        ans = (ans * powMod(it.first, Power, MOD))%MOD;
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

ll powMod(ll n, ll p, ll mod) {
    n %= mod;
    if(p == 0)
        return 1;
    return ((p&1 ? n:1) *  powMod(n*n, p/2, mod))%mod;
}

int main() {
    //fileRead("in");

    map<int, int>val;
    int n, x;
    cin >> n;

    while(n--) {
        cin >> x;
        val[x]++;
    }

    ll PowMul = 1, ans = 1;
    for(auto it : val)
        PowMul *= it.second+1;
    //cout << "power Mul " << PowMul << endl;
    for(auto it : val) {
        ll Power = (it.second * (it.second+1))/2;
        Power %= (MOD-1);
        //cout << it.first << " == " << Power << endl;
        Power = (Power * PowMul/(it.second+1)) % (MOD-1);
        //cout << it.first << " " << Power << endl;
        ans = (ans * powMod(it.first, Power, MOD))%MOD;
    }

    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX                 200100
#define EPS                 1e-9
#define INF                 1e9+10
#define MOD                 1000000007
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pi                  acos(-1)
#define sf                  scanf
#define pf                  printf
#define SIZE(a)             ((int)a.size())
#define Equal(a, b)         (abs(a-b) < EPS)
#define Greater(a, b)       (a >= (b+EPS))
#define GreaterEqual(a, b)  (a > (b-EPS))
#define fr(i, a, b)         for(register int i = (a); i < (int)(b); i++)
#define FastRead            ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbug(vari)          cerr << #vari << " = " << (vari) <<endl
#define isOn(S, j)          (S & (1 << j))
#define setBit(S, j)        (S |= (1 << j))
#define clearBit(S, j)      (S &= ~(1 << j))
#define toggleBit(S, j)     (S ^= (1 << j))
#define lowBit(S)           (S & (-S))
#define setAll(S, n)        (S = (1 << n) - 1)
#define fileRead(S)         freopen(S, "r", stdin);
#define fileWrite(S)        freopen(S, "w", stdout);
#define Unique(X)           X.erase(unique(X.begin(), X.end()), X.end())

typedef unsigned long long ull;
typedef long long ll;
typedef map<int, int> mii;
typedef map<ll, ll>mll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<long long>vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vii;
typedef vector<pair<ll, ll> >vll;

long long powMod(long long N, long long P, long long M) {
	if(P==0)
		return 1;
	if(P%2==0) {
		long long ret = powMod(N, P/2, M)%M;
		return (ret * ret)%M;
	}
	else
		return ((N%M) * (powMod(N, P-1, M)%M))%M;
}

int main() {
    int m, x;
    cin >> m;
    ll mul = 0;
    for(int i = 0; i < m; ++i) {
        cin >> x;
        if(i)
            mul = (mul * powMod(x, m, MOD))%MOD;
        else
            mul = powMod(x, m, MOD);
    }

    cout << mul << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 1;
const int MOD = ((int)1e9 + 7);
ll mod_power(ll b, ll p)
{
    ll ans = 1;
    while(p)
    {
        if (p & 1)
        {
            ans *= b % MOD;
            ans %= MOD;
        }
        b *= b % MOD;
        b %= MOD;
        p >>= 1;
    }
    return ans;
}
ll a[N], p[N], cnt[N];
int main()
{
    int m;
    scanf("%d", &m);
    for (int i = 0; i < m; i++)
        scanf("%d", a + i);
    sort(a, a + m);
    int l = 0;
    for (int i = 0; i < m; i++)
    {
        p[l] = a[i], cnt[l]++;
        if (a[i + 1] != a[i])l++;
    }
    ll f, d = 1, ans = 1;
    for (int i = 0; i < l; i++)
    {
        f = mod_power(p[i], cnt[i] * (cnt[i] + 1) / 2);
        ans = mod_power(ans, (cnt[i] + 1)) * mod_power(f, d) % MOD;
        d = d * (cnt[i] + 1) % (MOD - 1);
    }
    printf("%d\n", ans);
    return 0;
}


def readarray(foo): return [foo(x) for x in raw_input().split()]

def sieve(n):
	bad = set()
	yield 2
	for i in xrange(3, n, 2):
		if i in bad: continue
		yield i
		for j in xrange(i + i, n, i):
			bad.add(j)

def run():
	n = int(raw_input())
	if n == 2: return -1

	primes = list(sieve(1000))[1:n]
	res = []
	last = 1
	for p in primes:
		res.append(p * 2)
		last *= p
	res.append(last)
	return "\n".join(map(str, res))
print run()


n=int(raw_input())
sieve=[0 for x in range(100000)]
for i in range(2,101):
    if sieve[i]==0:
        for j in range(i*i,10001,i):
            sieve[j]=1

ans=1
cnt=0
i=2
if n<3:
    print "-1"
else:
    while cnt<n:
        if sieve[i]==0:
            ans=ans*i
            cnt+=1
        i+=1;

    cnt=0
    i=2
    while cnt<n:
        if sieve[i]==0:
            print ans/i
            cnt+=1
        i+=1


n=int(raw_input())
sieve=[0 for x in range(100000)]
for i in range(2,101):
    if sieve[i]==0:
        for j in range(i*i,10001,i):
            sieve[j]=1

ans=1
cnt=0
i=2
while cnt<n:
    if sieve[i]==0:
        ans=ans*i
        cnt+=1
    i+=1;

cnt=0
i=2
while cnt<n:
    if sieve[i]==0:
        print ans/i
        cnt+=1
    i+=1


n=input()
print '\n'.join(map(str,[15,10]+[6*x for x in range(1,n-1)])) if n>2 else -1


n=input()
print ' '.join(map(str,[15,10]+[6*x for x in range(1,n-1)])) if n>2 else -1


from operator import mul
import sys

def primes(n):
    pr = range(n)
    for i in xrange(2,n):
        if not pr[i]: continue
        ii=i*i
        if ii>n: break
        pr[ii::i]=[0]*len(pr[ii::i])
    return filter(None,pr)[1:]

n = input()
if n==2:
    print "-1"
    sys.exit(0)
pr = primes(250)
for i in range(n):
    pp = pr[:n]
    pp.remove(pr[i])
    print reduce(mul,pp,1)


pr = []
for i in xrange(2 , 10000):
    j = 2
    while j * j <= i:
        if i % j == 0:
            break
        else:
            j += 1
    if j * j > i:
        pr.append(i)
#>= pcnt - 1
#<= pcnt * (pcnt - 1) / 2
N = int(raw_input())
if N == 2:
    print "-1"
elif N <= 20:
    out = []
    M = 1
    for i in range(N):
        M *= pr[i]
    for i in range(N):
        out.append(M / pr[i])
else:
    out = []
    pcnt = 1
    while pcnt * (pcnt - 1) / 2 < N:
        pcnt += 1
    M = 1
    for i in range(pcnt):
        M *= pr[i]
    for i in range(pcnt):
        for j in range(i + 1 , pcnt):
            out.append(M / (pr[i] * pr[j]))
if N != 2:
    for n in range(N):
        print out[n]


pr = []
for i in xrange(2 , 10000):
    j = 2
    while j * j <= i:
        if i % j == 0:
            break
        else:
            j += 1
    if j * j > i:
        pr.append(i)
#>= pcnt - 1
#<= pcnt * (pcnt - 1) / 2
N = int(raw_input())
if N == 2:
    print "-1"
elif N <= 20:
    out = []
    M = 1
    for i in range(N):
        M *= pr[i]
    for i in range(N):
        out.append(M / pr[i])
else:
    out = []
    pcnt = 1
    while pcnt * (pcnt - 1) / 2 < N:
        pcnt += 1
    M = 1
    for i in range(pcnt):
        M *= pr[i]
    for i in range(pcnt):
        for j in range(i + 1 , pcnt):
            out.append(M / (pr[i] * pr[j]))
if N != 2:
    for n in out:
        print n


def isprime(n):
    i=2
    while i*i<=n:
        if(n%i==0):
            return 0
        i+=1
    return 1

n = input()
if n==2:
    print "-1"
else:
    t=2
    num =0
    p=[]
    while num<n+1:
        if isprime(t)==1:
            p+=[t]
            num+=1
        t+=1
    ans = n*[0]
    i=0
    while i<n-1 :
        ans[i]=p[0]*p[i+1]
        i+=1
    i=0
    ans[n-1]=1
    while i<n-1 :
        ans[n-1]*= p[i+1]
        i+=1
    i=0
    while i<n :
        print ans[i]
        i+=1


import sys
n=input()
if n==2:
    print '-1'
else:
    ret=[6,10,15]
    ad=[30*(i+1) for i in xrange(0,n-3)]
    ret+=ad
    for v in ret:
        print v


import sys
def isprime(n):
    i=2
    while i*i<=n:
        if n%i==0:
            return False
        i+=1
    return True
f=lambda:map(int, raw_input().split())
n=f()[0]
if n==2:
    print '-1'
    sys.exit(0)
ret=[6]+[10]*(n-2)+[15]
for v  in ret:
    print v


import math
p = [2]
def f(a):
        i = int(math.sqrt(a)) + 1
        for j in xrange(2, i + 1):
                if (a % j == 0):
                        return False
        return True

for i in xrange(2,300):
        if (f(i)):
                p.append(i)

idx = 0

n = int(raw_input())

j = 1

for i in xrange(0, n + 1):
        j *= p[i]

for i in xrange(0, n):
        print j / p[i]


import math
p = [2]
def f(a):
        i = int(math.sqrt(a)) + 1
        for j in xrange(2, i + 1):
                if (a % j == 0):
                        return False
        return True

for i in xrange(2,300):
        if (f(i)):
                p.append(i)

idx = 0

n = int(raw_input())

if (n <= 2):
        print -1
        exit(0)

j = 1

for i in xrange(0, n):
        j *= p[i]

for i in xrange(0, n):
        print j / p[i]


import math
p = [2]
def f(a):
        i = int(math.sqrt(a)) + 1
        for j in xrange(2, i + 1):
                if (a % j == 0):
                        return False
        return True

for i in xrange(2,300):
        if (f(i)):
                p.append(i)

idx = 0

n = int(raw_input())

j = 1

for i in xrange(0, n):
        j *= p[i]

for i in xrange(0, n):
        print j / p[i]


def is_prime(n):
  i = 2
  while i * i <= n:
    if n % i == 0:
      return False
    i += 1
  return True

def primes(n):
  k, p = 0, 2
  while k < n:
    if is_prime(p):
      yield p
      k += 1
    p += 1

n = input()
if n < 3:
  print -1
else:
  p = list(primes(n))
  answ = [1] * n
  for i in xrange(n):
    for j in xrange(n):
      if i != j:
        answ[i] *= p[j]
  for i in xrange(n):
    print answ[i]


p=[]
esp=[1]*1000000
p.append(2)
for i in range(3,1000000,2):
	if(esp[i]):
		p.append(i)
		for j in range(i*i,1000000,i*2):
			esp[j]=0
n=int(raw_input())
if(n==2):
	print -1
	exit(0)
common=1
for i in range(1,n-1):
	common*=p[i]
print common*2
j=n-1
for i in range(n-2):
	print common*p[j]
	j+=1
a=2
for j in range(n-1,2*n-3):
	a*=p[j]
print a


p=[]
esp=[1]*1000000
p.append(2)
for i in range(3,1000000,2):
	if(esp[i]):
		p.append(i)
		for j in range(i*i,1000000,i*2):
			esp[j]=0
n=int(raw_input())
if(n==2):
	print -1
	exit(0)
common=1
for i in range(n):
	common*=p[i]
for i in range(n):
	print common/p[i]


p=[]
esp=[1]*1000
p.append(2)
for i in range(3,1000,2):
	if(esp[i]):
		p.append(i)
		for j in range(i*i,1000,i*2):
			esp[j]=0
n=int(raw_input())
if(n==2):
	print -1
	exit(0)
common=1
for i in range(n):
	common*=p[i]
for i in range(n):
	print common/p[i]


p=[]
esp=[1]*1000000
p.append(2)
for i in range(3,1000000,2):
	if(esp[i]):
		p.append(i)
		for j in range(i*i,1000000,i*2):
			esp[j]=0
n=int(raw_input())
if(n==2 or n>45):
	print -1
	exit(0)
common=1
for i in range((n-1)/2,(n-1)/2+n-2):
	common*=p[i]
last=1
for i in range((n-1)/2):
	print common*p[i]
	last*=p[i]
for i in range((n-1)/2+n-2,(n-1)/2+n-2+n/2):
	print common*p[i]
	last*=p[i]
print last


p=[]
esp=[1]*1000000
p.append(2)
for i in range(3,1000000,2):
	if(esp[i]):
		p.append(i)
		for j in range(i*i,1000000,i*2):
			esp[j]=0
n=int(raw_input())
if(n==2):
	print -1
	exit(0)
pos=[]
a=1
for i in range(n-1):
	a*=p[i]
print a
pos.append([0,n-1])
for i in range(n-1):
	a=1
	for j in range(len(pos)):
		a*=p[pos[j][0]]
		pos[j][0]+=1
	pos.append([pos[i][1],pos[i][1]+n-i-2])
	for j in range(pos[i][1],pos[i][1]+n-i-2):
		a*=p[j]
	print a


import sys

primes = [2]
for i in range(3, 542, 2):
  if not any([ (i % p) == 0 for p in primes ]):
    primes.append(i)

n = int(raw_input())

if n == 2:
  print -1
  sys.exit()

res = primes[-n:]
for i in range(0, n):
  for j in range(0, n):
    if i != j:
      res[j] *= primes[i]

for i in range(0, n):
  print len(str(res[i]))


import sys

primes = [2]
for i in range(3, 542, 2):
  if not any([ (i % p) == 0 for p in primes ]):
    primes.append(i)

n = int(raw_input())

if n == 2:
  print -1
  sys.exit()

res = primes[-n:]
for i in range(0, n):
  for j in range(0, n):
    if i != j:
      res[j] *= primes[i]

for i in range(0, n):
  print res[i]


# -*- coding: utf-8 -*-
n = int(raw_input())

a = [2*3, 3*5]

def primegen(x=2):
    while True:
        if not [i for i in range(2,x) if x % i == 0]:
            yield x
        x += 1

if n == 2:
    print -1
else:
    ind = 0
    gen = a[0]*a[1]/3**2
    for p in primegen(x=7):
        if len(a) == n:
            break
        a.append(gen*p)
        ind = 1 - ind
    for i in a:
        print i


# -*- coding: utf-8 -*-
n = int(raw_input())

a = []

def primegen(x=2):
    while True:
        if not [i for i in range(2,x) if x % i == 0]:
            yield x
        x += 1

for p in primegen():
    a.append(p)
    if len(a) == n:
        break

for i in range(n-1):
    a[i] *= a[i+1]
a[n-1] *= 2

a = sorted(a)

if len(a) == 2:
    print -1
else:
    for i in a:
        print i


# -*- coding: utf-8 -*-
n = int(raw_input())

a = []

def primegen(x=2):
    while True:
        if not [i for i in range(2,x) if x % i == 0]:
            yield x
        x += 1

for p in primegen():
    a.append(p)
    if len(a) == n:
        break

for i in range(n-1):
    a[i] *= a[i+1]

a = sorted(a)

if len(a) == 2:
    print -1
else:
    for i in a:
        print i


class Main:
	n=int(input())
	if(n==2):
		print -1
	else:
		print 11*2
		print 11*3
		for i in range(1,n-1):
			print 7*6*i


n=10000
primes = [True] * (n+100)#范围0到n的列表
p = 2#这是最小的素数
while p * p <= n:#一直筛到sqrt(n)就行了
    if primes[p]:#如果没被筛，一定是素数
        for i in range(p * 2, n + 1, p):#筛掉它的倍数即可
            primes[i] = False
    p += 1
primes = [element for element in range(2, n) if primes[element]]#得到所有少于n的素数

nn=int(input())
if nn==2:
    print(-1)
else:
    ans=1
    for i in range(0,nn):
        ans=ans*primes[i]
    for i in range(0,nn):
        print(ans//primes[i])


n=1000000
primes = [True] * (n+1)#范围0到n的列表
p = 2#这是最小的素数
while p * p <= n:#一直筛到sqrt(n)就行了
    if primes[p]:#如果没被筛，一定是素数
        for i in range(p * 2, n + 1, p):#筛掉它的倍数即可
            primes[i] = False
    p += 1
primes = [element for element in range(2, n) if primes[element]]#得到所有少于n的素数

nn=int(input())
if nn==2:
    print(-1)
else:
    ans=1
    for i in range(0,nn):
        ans=ans*primes[i]
    for i in range(0,nn):
        print(ans//primes[i])


def primes(n):
  P = []
  f = []
  for i in range(n+1):
    if i > 2 and i%2 == 0:
      f.append(1)
    else:
      f.append(0)

  i = 3
  while i*i <= n:
    if f[i] == 0:
      j = i*i
      while j <= n:
        f[j] = 1
        j += i+i
    i += 2

  P.append(2)
  for i in range(3,n,2):
    if f[i] == 0:
      P.append(i)

  return P

if __name__ == '__main__':
    n = 100000
    P = primes(n)
    nn=int(input())
    if nn==2:
        print(-1)
    else:
        ans=1
        for i in range(0,nn):
            ans=ans*P[i]
        for i in range(0,nn):
            print(ans//P[i])


n=1000000
primes = [True] * (n+100)#范围0到n的列表
p = 2#这是最小的素数
while p * p <= n:#一直筛到sqrt(n)就行了
    if primes[p]:#如果没被筛，一定是素数
        for i in range(p * 2, n + 1, p):#筛掉它的倍数即可
            primes[i] = False
    p += 1
primes = [element for element in range(2, n) if primes[element]]#得到所有少于n的素数

nn=int(input())
if nn==2:
    print(-1)
else:
    ans=1
    for i in range(0,nn):
        ans=ans*primes[i]
    for i in range(0,nn):
        print(ans//primes[i])


#python实现素数筛
def sieve_of_eratosthenes(n):#埃拉托色尼筛选法，返回少于n的素数
    primes = [True] * (n+1)#范围0到n的列表
    p = 2#这是最小的素数
    while p * p <= n:#一直筛到sqrt(n)就行了
        if primes[p]:#如果没被筛，一定是素数
            for i in range(p * 2, n + 1, p):#筛掉它的倍数即可
                primes[i] = False
        p += 1
    primes = [element for element in range(2, n) if primes[element]]#得到所有少于n的素数
    return primes
if __name__ == '__main__':
    n = 100000
    P = sieve_of_eratosthenes(n)
    nn=int(input())
    if nn==2:
        print(-1)
    else:
        ans=1
        for i in range(0,nn):
            ans=ans*P[i]
        for i in range(0,nn):
            print(ans//P[i])


#python实现素数筛
def primes(n):
  P = []
  f = []
  for i in range(n+1):
    if i > 2 and i%2 == 0:
      f.append(1)
    else:
      f.append(0)

  i = 3
  while i*i <= n:
    if f[i] == 0:
      j = i*i
      while j <= n:
        f[j] = 1
        j += i+i
    i += 2

  P.append(2)
  for i in range(3,n,2):
    if f[i] == 0:
      P.append(i)

  return P

if __name__ == '__main__':
    n = 100000
    P = primes(n)
    nn=int(input())
    if nn==2:
        print(-1)
    else:
        ans=1
        for i in range(0,nn):
            ans=ans*P[i]
        for i in range(0,nn):
            print(ans//P[i])


def primes(n):
  P = []
  f = []
  for i in range(n+1):
    if i > 2 and i%2 == 0:
      f.append(1)
    else:
      f.append(0)

  i = 3
  while i*i <= n:
    if f[i] == 0:
      j = i*i
      while j <= n:
        f[j] = 1
        j += i+i
    i += 2

  P.append(2)
  for i in range(3,n,2):
    if f[i] == 0:
      P.append(i)

  return P

def isPrime(n):
  if n > 2 and n%2 == 0:
    return 0

  i = 3
  while i*i <= n:
    if n%i == 0:
      return 0
    i += 2

  return 1

def primeCnt(n):
  cnt = 0
  for i in range(2,n):
    if isPrime(i):
      cnt += 1
  return cnt

if __name__ == '__main__':
    n = 10000000
    P = primes(n)
    nn=int(input())
    if nn==2:
        print(-1)
    else:
        ans=1
        for i in range(0,nn):
            ans=ans*P[i]
        for i in range(0,nn):
            print(ans//P[i])
  #for i in range(10):
  #  print(P[i])


n=100
primes = [True] * (n+1)#范围0到n的列表
p = 2#这是最小的素数
while p * p <= n:#一直筛到sqrt(n)就行了
    if primes[p]:#如果没被筛，一定是素数
        for i in range(p * 2, n + 1, p):#筛掉它的倍数即可
            primes[i] = False
    p += 1
primes = [element for element in range(2, n) if primes[element]]#得到所有少于n的素数

a=[]
nn=int(input())
if nn==2:
    print(-1)
else:
    ans=1
    for i in range(0,nn):
        ans=ans*primes[i]
    for i in range(0,nn):
        print(ans//primes[i])


f=[0 for x in range(1,1000)];
g=[0 for x in range(1,1000)];
t=1;cnt=0;
n=int(raw_input());
if n==2:
    print -1;
if n!=2:
    for x in xrange (2,1000):
        if f[x]==0:
            i=x+x;
            t*=x;
            g[cnt]=x;cnt+=1;
            if cnt==n:
                break;
            while i<=800:
                f[i]=1;
                i+=x;
    for i in xrange(0,n):
        print t/g[i];


f=[0 for x in range(1,1000)];
g=[0 for x in range(1,1000)];
t=1;cnt=0;
n=int(raw_input());
for x in xrange (2,1000):
    if f[x]==0:
        i=x+x;
        t*=x;
        g[cnt]=x;cnt+=1;
        if cnt==n:
            break;
        while i<=800:
            f[i]=1;
            i+=x;
for i in xrange(0,n):
    print t/g[i];


#!/usr/bin/env python

n=int(raw_input())
if n==2:
	print -1
	exit(0)
a=[2]
k=3
while len(a)<n:
	found=True
	for i in a:
		if k%i==0:
			found=False
			break
	if found:
		a.append(k)
	k+=1

ans=[1]*n
for i in range(n):
	for j in range(n):
		if j==i:
			continue
		ans[j]*=a[i]

for i in ans:
	print i


import math
def isPrime(n):
    for i in range(2,n):
        if n%i==0:
            return 0
    return 1
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

n=int(input())
if n==2:
    print(-1)
else:
    primes =[ ]
    at=2
    while len(primes)< n:
     while isPrime(at)==0:
         at=at+1
     primes.append(at)
     at=at+1
    res =[]
    at=0
    for i in range(0,n-1):
        res.append(2)
    res.append(1)
    at=1
    for i in range(0,n-1):
        res[n-1]=res[n-1]*primes[at]
        res[i]=res[i]*primes[at]
        at=at+1
    for i in range(0,n):
        print(res[i])
    g=res[0]
    for i in range(1,n):
        g=gcd(g,res[i])


ans=[]
n=0
ret=[]

def dfs(cur,pos,cnt,b):
	if cnt==n-1:
		ans.append(cur)
		return
	if b==0:
		dfs(cur,pos+1,cnt,1)
	dfs(cur*ret[pos],pos+1,cnt+1,b)

def prime():
	ret=[]
	ret.append(2)
	sig=[1 for i in range(1000)]
	for i in range(3,1000,2):
		if sig[i]==1:
			ret.append(i)
			for j in range(i+i,1000,i):
				sig[j]=0

	return ret

n=input()
ret=prime()[:n]
if n==2:
	print -1
else :
	dfs(1,0,0,0)
	for i in range(n):
		print ans[i]


def check(k):
	i = 2
	ret = 1
	while i * i <= k:
		if k % i == 0:
			ret = 0
		i += 1
	return ret

n = int(input())

if n == 2:
	print -1;
	exit();

el = []

for i in range(0, n):
	el.append(1)
for i in range(0, n):
	el[i] = 1
p = 2

for i in range(0, n):
	while check(p) == 0:
		p += 1
	for j in range(0, n):
		if i != j:
			el[j] *= p
	p += 1

for i in el:
	print i


from math import sqrt
from sys import exit
def prime(x):
    if x < 2:
        return False
    if x == 2 or x == 3:
        return True
    if x%2 == 0 or x%3 == 0:
        return False
    for i in xrange(3,int(sqrt(x)) +3,2):
        if(x%i == 0):
            return False
    return True

n = int(raw_input())
if n == 2:
    print -1
else:
    P = 1
    cnt=0
    v = []
    for i in xrange(2,12345678):
        if prime(i):
            P*=i
            v.append(i)
            cnt+=1
            if cnt == n:
                break

    for i in v:
        print P/i


from math import sqrt
def prime(x):
    if x < 2:
        return False
    if x == 2 or x == 3:
        return True
    if x%2 == 0 or x%3 == 0:
        return False
    for i in xrange(3,int(sqrt(x)) +3,2):
        if(x%i == 0):
            return False
    return True

n = int(raw_input())
P = 1
cnt=0
v = []
for i in xrange(2,12345678):
    if prime(i):
        P*=i
        v.append(i)
        cnt+=1
        if cnt == n:
            break

for i in v:
    print P/i


'''
Created on 2011-3-16

@author: zhxfl
'''
n=input()
if n==2:print -1
else :
    print 10
    for i in range(n-2):
        print pow(2,i)*6
    print 15


from operator import mul

MAX_N = 1000
isprime = [True] * MAX_N
isprime[0] = isprime[1] = False
for i in xrange(2, MAX_N):
    if isprime[i]:
        for j in xrange(i + i, MAX_N, i):
            isprime[j] = False
primes = [i for i in xrange(MAX_N) if isprime[i]]

n = int(raw_input())

if n == 2:
    print -1
else:
    ans = primes[0:n]
    ans[1:] = [primes[n] * x for x in ans[1:]]
    ans[0] *= reduce(mul, primes[1:n])
    print '\n'.join([str(x) for x in ans])


def primes(n):
	if n==2: return [2]
	elif n<2: return []
	s=range(3,n+1,2)
	mroot = n ** 0.5
	half=(n+1)/2-1
	i=0
	m=3
	while m <= mroot:
		if s[i]:
			j=(m*m-3)/2
			s[j]=0
			while j<half:
				s[j]=0
				j+=m
		i=i+1
		m=2*i+3
	return [2]+[x for x in s if x]

s = primes(300)
n = int(raw_input())

if n == 2:
	print -1
	quit()

for i in range(n):
	ans = 1
	for j in range(n):
		if j != i:
			ans *= s[j]
	print ans


n=input()
N=[15,10,6]
if n == 2:
    N=[-1]
else:
    N+=map(lambda x:15*x,range(2,n))
print '\n'.join(map(str, N[:n]))


MAXN = 250
Primes = []
P = [0 for i in range(MAXN)]
def sieve():
	for i in xrange(2,MAXN):
		if(i*i>MAXN):
			break
		if P[i] == 1:
			continue
		for j in xrange(i*i,MAXN,i):
			P[j] = 1
	for i in xrange(2,MAXN):
		if P[i]==0:
			Primes.append(i)

sieve()
N = input()
Ans = 1
for i in range(N):
	print Primes[i]
	Ans = Ans * Primes[i]
for i in range(N):
	print Ans/Primes[i]


MAXN = 250
Primes = []
P = [0 for i in range(MAXN)]
def sieve():
	for i in xrange(2,MAXN):
		if(i*i>MAXN):
			break
		if P[i] == 1:
			continue
		for j in xrange(i*i,MAXN,i):
			P[j] = 1
	for i in xrange(2,MAXN):
		if P[i]==0:
			Primes.append(i)

sieve()
N = input()
Ans = 1
if(N>2):
	for i in range(N):
		Ans = Ans * Primes[i]
	for i in range(N):
		print Ans/Primes[i]
else: print -1


MAXN = 250
Primes = []
P = [0 for i in range(MAXN)]
def sieve():
	for i in xrange(2,MAXN):
		if(i*i>MAXN):
			break
		if P[i] == 1:
			continue
		for j in xrange(i*i,MAXN,i):
			P[j] = 1
	for i in xrange(2,MAXN):
		if P[i]==0:
			Primes.append(i)

sieve()
N = input()
Ans = 1
for i in range(N):
	Ans = Ans * Primes[i]
for i in range(N):
	print Ans/Primes[i]


import sys
import math
a = []
a.append(2)
a.append(3)
a.append(5)
a.append(7)
a.append(11)
a.append(13)
a.append(17)
a.append(19)
a.append(23)
a.append(29)
a.append(31)
a.append(37)
a.append(41)
a.append(43)
a.append(47)
a.append(53)
a.append(59)
a.append(61)
a.append(67)
a.append(71)
a.append(73)
a.append(79)
a.append(83)
a.append(89)
a.append(97)
a.append(101)
a.append(103)
a.append(107)
a.append(109)
a.append(113)
a.append(127)
a.append(131)
a.append(137)
a.append(139)
a.append(149)
a.append(151)
a.append(157)
a.append(163)
a.append(167)
a.append(173)
a.append(179)
a.append(181)
a.append(191)
a.append(193)
a.append(197)
a.append(199)
a.append(211)
a.append(223)
a.append(227)
a.append(229)

for n in sys.stdin:
    n = int(n)
    sum = 1
    for i in range(n):
        sum *= a[i]
    for i in range(n):
        print sum/a[i]


import sys
import math
a = []
a.append(2)
a.append(3)
a.append(5)
a.append(7)
a.append(11)
a.append(13)
a.append(17)
a.append(19)
a.append(23)
a.append(29)
a.append(31)
a.append(37)
a.append(41)
a.append(43)
a.append(47)
a.append(53)
a.append(59)
a.append(61)
a.append(67)
a.append(71)
a.append(73)
a.append(79)
a.append(83)
a.append(89)
a.append(97)
a.append(101)
a.append(103)
a.append(107)
a.append(109)
a.append(113)
a.append(127)
a.append(131)
a.append(137)
a.append(139)
a.append(149)
a.append(151)
a.append(157)
a.append(163)
a.append(167)
a.append(173)
a.append(179)
a.append(181)
a.append(191)
a.append(193)
a.append(197)
a.append(199)
a.append(211)
a.append(223)
a.append(227)
a.append(229)

for n in sys.stdin:
    n = int(n)
    sum = 1
    if n==2:
        print -1
        continue
    for i in range(n):
        sum *= a[i]
    for i in range(n):
        print sum/a[i]


import sys
import math
MAX = 300
a = []
prime = []
for i in range(0, MAX+1):
    a.append(1)
a[0] = a[1] = 0
M = int(math.sqrt(MAX+0.5))
for i in range(2, M, 1):
    if a[i]==1:
        for j in range(i*i, MAX+1, i):
            a[j] = 0
count = 0;
for i in range(MAX+1):
    if a[i] == 1:
        prime.append(i)
        count = count+1

for n in sys.stdin:
    n = int(n)
    sum = 1
    for i in range(n):
        sum *= prime[i]
    for i in range(n):
        print sum/prime[i]


import sys
import math
a = []
a.append(2)
a.append(3)
a.append(5)
a.append(7)
a.append(11)
a.append(13)
a.append(17)
a.append(19)
a.append(23)
a.append(29)
a.append(31)
a.append(37)
a.append(41)
a.append(43)
a.append(47)
a.append(53)
a.append(59)
a.append(61)
a.append(67)
a.append(71)
a.append(73)
a.append(79)
a.append(83)
a.append(89)
a.append(97)
a.append(101)
a.append(103)
a.append(107)
a.append(109)
a.append(113)
a.append(127)
a.append(131)
a.append(137)
a.append(139)
a.append(149)
a.append(151)
a.append(157)
a.append(163)
a.append(167)
a.append(173)
a.append(179)
a.append(181)
a.append(191)
a.append(193)
a.append(197)
a.append(199)
a.append(211)
a.append(223)
a.append(227)
a.append(229)
print len(a)
for n in sys.stdin:
    n = int(n)
    for i in range(n):
        sum *= a[i]
    for i in range(n):
        print sum/a[i]


import sys
import math
a = []
a.append(2)
a.append(3)
a.append(5)
a.append(7)
a.append(11)
a.append(13)
a.append(17)
a.append(19)
a.append(23)
a.append(29)
a.append(31)
a.append(37)
a.append(41)
a.append(43)
a.append(47)
a.append(53)
a.append(59)
a.append(61)
a.append(67)
a.append(71)
a.append(73)
a.append(79)
a.append(83)
a.append(89)
a.append(97)
a.append(101)
a.append(103)
a.append(107)
a.append(109)
a.append(113)
a.append(127)
a.append(131)
a.append(137)
a.append(139)
a.append(149)
a.append(151)
a.append(157)
a.append(163)
a.append(167)
a.append(173)
a.append(179)
a.append(181)
a.append(191)
a.append(193)
a.append(197)
a.append(199)
a.append(211)
a.append(223)
a.append(227)
a.append(229)

for n in sys.stdin:
    n = int(n)
    for i in range(n):
        sum *= a[i]
    for i in range(n):
        print sum/a[i]


def sieve(n):
    primes=[]
    marked=[False]*(n+1)
    for i in range(2,n+1):
        if not marked[i]:
            primes.append(i)
            for m in range(i**2, n+1, i):
                marked[m] = True
    return primes

def main():
    p = sieve(300)
    n = int(raw_input())
    if n==2:
        print 2
        print 3
        return
    a = p[0:n]
    for i in range(len(a)-1):
        print a[i]*a[len(a)-1]

    c=1
    for i in a:
        c*=i
    print c*p[n]/a[n-1]

if __name__ == "__main__":
    main()


def sieve(n):
    primes=[]
    marked=[False]*(n+1)
    for i in range(2,n+1):
        if not marked[i]:
            primes.append(i)
            for m in range(i**2, n+1, i):
                marked[m] = True
    return primes

def main():
    p = sieve(300)
    n = int(raw_input())
    a = p[0:n]
    for i in range(len(a)-1):
        print a[i]*a[len(a)-1]

    c=1
    for i in a:
        c*=i
    print c*p[n]/a[n-1]

if __name__ == "__main__":
    main()


def sieve(n):
    primes=[]
    marked=[False]*(n+1)
    for i in range(2,n+1):
        if not marked[i]:
            primes.append(i)
            for m in range(i**2, n+1, i):
                marked[m] = True
    return primes

def main():
    p = sieve(300)
    n = int(raw_input())
    if n==2:
        print 2
        print 3
        return
    a = p[0:n]

    for i in range(len(a)-1):
        print a[i]*a[len(a)-1]

    c=1
    for i in a:
        c*=i
    print c*p[n]

if __name__ == "__main__":
    main()


def sieve(n):
    primes=[]
    marked=[False]*(n+1)
    for i in range(2,n+1):
        if not marked[i]:
            primes.append(i)
            for m in range(i**2, n+1, i):
                marked[m] = True
    return primes

def main():
    p = sieve(300)
    n = int(raw_input())
    if n==2:
        print -1
        return
    a = p[0:n]
    for i in range(len(a)-1):
        print a[i]*a[len(a)-1]

    c=1
    for i in a:
        c*=i
    print c*p[n]/a[n-1]

if __name__ == "__main__":
    main()


def sieve(n):
    primes=[]
    marked=[False]*(n+1)
    for i in range(2,n+1):
        if not marked[i]:
            primes.append(i)
            for m in range(i**2, n+1, i):
                marked[m] = True
    return primes

def main():
    p = sieve(300)
    n = int(raw_input())
    a = p[0:n]

    for i in range(len(a)-1):
        print a[i]*a[len(a)-1]

    c=1
    for i in a:
        c*=i
    print c*p[n]

if __name__ == "__main__":
    main()


import math
n = int(raw_input())
def __check(a):
    for i in xrange(2, int(math.sqrt(a))+1):
        if a % i == 0:
            return 0
    return 1
if n == 2:
    print -1
else:
    summary = 1
    counter = 0
    i = 2
    while counter != n:
        if __check(i) == 1:
            summary*=i
            counter+=1
        i+=1
    counter = 0
    i=2
    while counter != n:
        if __check(i) == 1:

            print summary / i
            counter += 1
        i+=1


import pdb
n = int(raw_input())
vis = []
prime = []

for i in range(1, 1000000):
    vis.append(0)
def get(n):
    tot = 0
    for i in range(2, 100000):
        #        pdb.set_trace()
        if (vis[i] == 0):
            prime.append(i)
            tot = tot+1
        if (tot >= n*3):
            break
        for j in range(0,tot):
            vis[i*prime[j]] = 1
            if (i*prime[j] >= 1000000):
                break
            if (i%prime[j] == 0):
                break
get(n)
if (n == 2):
    print (-1)
else:
    val = 1
    for i in range(0, n):
        val = val*prime[i]
    for i in range(0, n):
        print (val/prime[i])


import pdb
n = int(raw_input())
vis = []
prime = []

for i in range(1, 1000000):
    vis.append(0)
def get(n):
    tot = 0
    for i in range(2, 100000):
#        pdb.set_trace()
        if (vis[i] == 0):
            prime.append(i)
            tot = tot+1
        if (tot >= n*3):
            break
        for j in range(0,tot):
            vis[i*prime[j]] = 1
            if (i*prime[j] >= 1000000):
                break
            if (i%prime[j] == 0):
                break
get(n)
for i in range(0, n):
#    pdb.set_trace()
    val = 1
    if (i != n-1):
        for j in range(i, i+n-1):
            val = val*prime[j]
    else :
        for j in range(i, i+n-2):
            val = val*prime[j]
        val = val*prime[0]
    print (val)


import pdb
n = int(raw_input())
vis = []
prime = []

for i in range(1, 1000000):
    vis.append(0)
def get(n):
    tot = 0
    for i in range(2, 100000):
        #        pdb.set_trace()
        if (vis[i] == 0):
            prime.append(i)
            tot = tot+1
        if (tot >= n*3):
            break
        for j in range(0,tot):
            vis[i*prime[j]] = 1
            if (i*prime[j] >= 1000000):
                break
            if (i%prime[j] == 0):
                break
get(n)
if (n == 2):
    print (-1)
else:
    for i in range(0, n):
#        pdb.set_trace()
        val = 1
        if (i != n-1):
            for j in range(i, i+n-1):
                val = val*prime[j]
        else:
            for j in range(i, i+n-2):
                val = val*prime[j]
            val = val*prime[0]
        print (val)


N = (int)(raw_input())
if N == 2:
        print "-1"
else:
        np = []
        for i in range(0, 20000):
                np.append(0);
        pl = [];
        for i in range(2, 20000, 1):
                if np[i] == 0:
                        pl.append(i)
                        for j in range(i*i, 20000, i):
                                np[j] = 1
        res = []
        for i in range(N):
                res.append(1)
        ptr = 0
        for i in range(N):
                for j in range(i+1, N):
                        res[j] = res[j] * pl[ptr]
                        res[i] = res[i] * pl[ptr]
                        ptr = ptr + 1
                #res[i] = res[i] * pl[ptr]
                #ptr = ptr + 1
        valid = 1
        lim = 10**100
        for i in range(N):
                if res[i] >= lim:
                        valid = 0
        if valid == 1:
                for i in range(N):
                        print res[i]
        else:
                print -1


N = (int)(raw_input())
if N == 2:
        print "-1"
else:
        np = []
        for i in range(0, 20000):
                np.append(0);
        pl = [];
        for i in range(2, 20000, 1):
                if np[i] == 0:
                        pl.append(i)
                        for j in range(i*i, 20000, i):
                                np[j] = 1
        res = []
        for i in range(N):
                res.append(1)
        ptr = 0
        for i in range(N-1):
                res[i] = res[i] * 2
                res[i+1] = res[i+1] * 3
        res[0] = res[0] * 5
        res[N-1] = res[N-1] * 5
        ptr = 3
        for i in range(1, N-1):
                res[i] = res[i] * pl[ptr]
                ptr = ptr + 1
        valid = 1
        lim = 10**100
        for i in range(N):
                if res[i] >= lim:
                        valid = 0
        if valid == 1:
                for i in range(N):
                        print res[i]
        else:
                print -1