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.

Input

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).

Output

Print one integer — the product of all divisors of n modulo 109 + 7.

Examples

Input

2
2 3


Output

36


Input

3
2 3 2


Output

1728

Note

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.
import java.util.*;
import java.io.*;
public class d {
public static void main(String[] args) throws IOException
{
    //System.out.println((2l*3*5*7*6*10*14*15*21*35*30*42*105*210*70)%mod);
    Scanner2 input = new Scanner2(System.in);
    PrintWriter out = new PrintWriter(System.out);
    
    int n = input.nextInt();
    int[] vals = new int[n];
    for(int i = 0; i<n; i++) vals[i] = input.nextInt();
    int size = 200001;
    int[] count = new int[size];
    for(int i = 0; i<n; i++) count[vals[i]]++;
    long[] pref = new long[size];
    long[] prods = new long[size];
    long[] suff = new long[size];
    
    for(int i = 0; i<size; i++)
    {
        prods[i] = 1;
        for(int j = 1; j<=count[i]; j++)
            prods[i]++;
    }
    pref[0] = 1;
    for(int i = 1; i<pref.length; i++)
    {
        pref[i] = (pref[i-1] * (prods[i]))%(mod - 1);
    }
    suff[size-1] = 1;
    for(int i = size-2; i>=0; i--)
    {
        suff[i] = (suff[i+1] * (prods[i]))%(mod - 1);
    }
    long res = 1;
    for(int i = 1; i<size-1; i++)
    {
        if(count[i] == 0) continue;
        long prod = 1;
        for(int j = 1; j<=count[i]; j++)
        {
            prod *= pow(i, j, mod);
            prod %= mod;
        }
        long exp = (pref[i-1] * suff[i+1])%(mod - 1);
        //out.println(prod+" "+exp);
        exp = Math.max(1, exp);
        res *= pow(prod, exp, mod);
        res %= mod;
    }
    out.println(res);
    out.close();
}
public static long[] gcd(long p, long q)
{
if(q==0)
    return new long[] {p, 1, 0};
long[] vals = gcd(q, p%q);
return new long[] {vals[0], vals[2], vals[1] - (p/q)*vals[2]};
}
public static long invmod(long x, long mod)
{
long[] vals = gcd(x, mod);
if(vals[0]>1)
    return -1;
if(vals[1]>0)
    return vals[1];
return mod + vals[1];
}
static long mod = (long)(1e9+7);
static long pow(long x, long p, long mod)
{
    if(p == 0) return 1;
    if(p%2 == 0)
    {
        long sqrt = pow(x, p/2, mod);
        return (sqrt*sqrt)%mod;
    }
    return (x * pow(x, p-1, mod))%mod;
}
static class Scanner2
{
    BufferedReader reader;
    StringTokenizer tokenizer;
    public Scanner2(InputStream input)
    {
        reader = new BufferedReader(new InputStreamReader(input));
    }
    public String next() throws IOException
    {
        while(tokenizer == null || !tokenizer.hasMoreTokens())
        {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(next());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(next());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(next());
    }
}
}
