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.io.*;
import java.util.*;
public final class multipliers
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static long mod=(long)(1e9)+7;
	static int maxn=(int)(2e5)+3;
	
	static long pow(long a,long b)
	{
		long x=1,y=a%mod;
		while(b>0)
		{
			if(b%2==1)
			{
				x=(x*y)%mod;
			}
			y=(y*y)%mod;b=b/2L;
		}
		return x;
	}
	
	static void brute(int[] a)
	{
		long curr=1;
		for(int i=0;i<a.length;i++)
		{
			curr=curr*a[i];
		}
		long prod=1;
		for(int i=1;i*i<=curr;i++)
		{
			if(curr%i==0)
			{
				prod=(prod*i)%mod;
				if(i!=(curr/i))
				{
					prod=(prod*(curr/i))%mod;
				}
			}
		}
		out.println(prod);
	}
	
    public static void main(String args[]) throws Exception
    {
		int n=sc.nextInt();int[] a=new int[n],cnt=new int[maxn];
		for(int i=0;i<n;i++)
		{
			a[i]=sc.nextInt();cnt[a[i]]++;
		}
		long prod=0;long[] left=new long[maxn],right=new long[maxn];
		for(int i=1;i<maxn;i++)
		{
			if(cnt[i]>0)
			{
				long now=(prod*cnt[i])%(mod-1);prod=(prod+now)%(mod-1L);prod=(prod+cnt[i])%(mod-1);
			}
			left[i]=prod;
		}
		prod=0;
		for(int i=maxn-1;i>=1;i--)
		{
			if(cnt[i]>0)
			{
				long now=(prod*cnt[i])%(mod-1);prod=(prod+now)%(mod-1L);prod=(prod+cnt[i])%(mod-1);
			}
			right[i]=prod;
		}
		long res=1;
		for(int i=2;i<maxn;i++)
		{
			long num=1;
			while(num<=cnt[i])
			{
				long curr=pow(i,num),now=(left[i-1]*right[i+1])%(mod-1);now=(now+(left[i-1]+right[i+1]+1L))%(mod-1);long val=pow(curr,now);res=(res*val)%mod;
				num++;
			}
		}
		out.println(res);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}