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 class D615 {
	static long mod = (long)1e9+7;
public static void main(String[] args) throws IOException {
	input.init(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], prods = new long[size], 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] = suff[size-1] = 1;
   for(int i = 1; i<pref.length; i++) pref[i] = (pref[i-1] * (prods[i]))%(mod - 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 = (prod * pow(i, j, mod))%mod;
       long exp = Math.max(1, (pref[i-1] * suff[i+1])%(mod - 1));
       res = (res * pow(prod, exp, mod))%mod;
   }
   out.println(res);
	out.close();
}
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;
}
public static class input {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(reader.readLine());
		return tokenizer.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
}
}

