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.
// practice with rainboy
import java.io.*;
import java.util.*;

public class CF615D extends PrintWriter {
	CF615D() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF615D o = new CF615D(); o.main(); o.flush();
	}

	static final int MD = 1000000007, MD1 = MD - 1;
	long power(int a, int k) {
		if (k == 0)
			return 1;
		long p = power(a, k / 2);
		p = p * p % MD;
		if ((k & 1) == 1)
			p = p * a % MD;
		return p;
	}
	void main() {
		int n = sc.nextInt();
		int[] aa = new int[n];
		for (int i = 0; i < n; i++)
			aa[i] = sc.nextInt();
		aa = Arrays.stream(aa).boxed().sorted().mapToInt($->$).toArray();
		int[] bb = new int[n];
		int[] kk = new int[n];
		int m = 0;
		for (int i = 0, j; i < n; i = j) {
			j = i + 1;
			while (j < n && aa[j] == aa[i])
				j++;
			bb[m] = aa[i];
			kk[m] = j - i;
			m++;
		}
		int[] pp = new int[m];
		int p = 1;
		for (int h = 0; h < m; h++) {
			pp[h] = p;
			p = (int) ((long) p * (kk[h] + 1) % MD1);
		}
		int[] qq = new int[m];
		int q = 1;
		for (int h = m - 1; h >= 0; h--) {
			qq[h] = q;
			q = (int) ((long) q * (kk[h] + 1) % MD1);
		}
		long ans = 1;
		for (int h = 0; h < m; h++) {
			int b = bb[h];
			long k = (long) kk[h] * (kk[h] + 1) / 2 % MD1 * pp[h] % MD1 * qq[h] % MD1;
			ans = ans * power(b, (int) k) % MD;
		}
		println(ans);
	}
}
