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 D {
	FastScanner in;
	PrintWriter out;

	final long mod = (long) (1e9 + 7);

	long pow(long n, long k) {
		if (k == 0) {
			return 1;
		}
		long x = pow(n, k / 2);
		x = (x * x) % mod;
		if (k % 2 == 1) {
			x = (x * n) % mod;
		}
		return x;
	}
	
	void solve() {
		int m = in.nextInt();
		long[] p = new long[m];
		for (int i = 0; i < m; i++) {
			p[i] = in.nextLong();
		}
		Arrays.sort(p);
		long cnt = 1, x = 1;
		for (int l = 0; l < m;) {
			int r = l;
			while (r < m && p[r] == p[l]) {
				r++;
			}
			long mul = 1;
			long newCnt = cnt, newX = x;
			for (int i = 0; i < r - l; i++) {
				mul = (mul * p[l]) % mod;
				newCnt = (newCnt + cnt) % (mod - 1);
				newX = (pow(mul, cnt) * x % mod * newX) % mod;
			}
			cnt = newCnt;
			x = newX;
			l = r;
		}
		out.println(x);
	}

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

	public static void main(String[] args) {
		new D().run();
	}
}