Ayrat has number n, represented as it's prime factorization pi of size m, i.e. n = p1·p2·...·pm. Ayrat got secret information that that the product of all divisors of n taken modulo 109 + 7 is the password to the secret data base. Now he wants to calculate this value.
The first line of the input contains a single integer m (1 ≤ m ≤ 200 000) — the number of primes in factorization of n.
The second line contains m primes numbers pi (2 ≤ pi ≤ 200 000).
Print one integer — the product of all divisors of n modulo 109 + 7.
2 2 3
36
3 2 3 2
1728
In the first sample n = 2·3 = 6. The divisors of 6 are 1, 2, 3 and 6, their product is equal to 1·2·3·6 = 36.
In the second sample 2·3·2 = 12. The divisors of 12 are 1, 2, 3, 4, 6 and 12. 1·2·3·4·6·12 = 1728.
参考:http://blog.csdn.net/viphong/article/details/50615502
所以可得素因子p[i]的贡献为p[i]^((t[i]*(t[i]+1)/2)*(sum/(t[i]+1)));
/* ***********************************************
Author : ryc
Created Time : 2016-08-12 Friday
File Name : E:\acm\codeforces\367D.cpp
Language : c++
Copyright 2016 ryc All Rights Reserved
************************************************ */
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<list>
#include<vector>
#include<map>
#include<string>
#define MOD 1000000007ll
using namespace std;
const int maxn=200010;
typedef long long LL;
LL t[maxn];
LL Pow(LL a,LL b){
if(b==0)return 1%MOD;
long long temp=Pow(a,b>>1);
temp=temp*temp%MOD;
if(b&1)temp=temp*a%MOD;
return temp;
}
int main()
{
LL n,m;cin>>m;
for(LL i=1;i<=m;++i){
scanf("%lld",&n);t[n]++;
}
LL sum=1;
for(int i=1;i<maxn;++i){
if(t[i])sum=sum*(t[i]+1)%(2*MOD-2);
}
LL ans=1;
for(LL i=1;i<maxn;++i){
if(t[i]){
ans=ans*Pow(i,sum*t[i]/2ll%(MOD-1))%MOD;
}
}
printf("%lld\n",ans);
return 0;
}