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.
//package com.jetbrains;

import java.io.*;
import java.util.*;
import java.lang.*;
public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		try
		{
			InputReader in = new InputReader(System.in);
			PrintWriter out = new PrintWriter(System.out);
			int n=in.nextInt();
			long m[][]= new long[n][2];
			int num[]=new int[n];
			int i=0,j=0;
			long tp,tn=1;
			for(i=0;i<n;i++)
			{
				num[i]=in.nextInt();
			}
			sort(num,0,n-1);
			m[j][0]=num[0];
			m[j][1]=2;
			//out.print(num[0]+"m");
			for(i=1;i<n;i++)
			{
				if(num[i]==num[i-1])
				{
					m[j][1]+=1;
				}
				else
				{
					j+=1;
					m[j][0]=(long)num[i];
					m[j][1]=2;
				}
			}
			tp=1;
			for(i=0;i<=j;i++)
			{
				tp = (m[i][1] * tp)%(2*1000000007 - 2);
			}
			//out.println();
			tn=1;
			for(i=0;i<=j;i++)
			{
				long cal=(tp*(m[i][1]-1) )/2;
				tn=(tn*power(m[i][0],cal,1000000007))%1000000007;
			}
			out.println(tn);
			out.close();
		}
		catch(Exception e){

		}
	}
	public static long power(long x, long y, long p)
	{
		// Initialize result
		long res = (long)1;

		// Update x if it is more
		// than or equal to p
		x = x % p;

		while (y > 0)
		{
			// If y is odd, multiply x
			// with result
			if((y & 1)==1)
				res = (res * x) % p;

			// y must be even now
			// y = y / 2
			y = y >> 1;
			x = (x * x) % p;
		}
		return res;
	}
	public static void merge(int arr[], int l, int m, int r)
	{
		int n1 = m - l + 1;
		int n2 = r - m;
		int L[] = new int [n1];
		int R[] = new int [n2];
		for (int i=0; i<n1; ++i)
			L[i] = arr[l + i];
		for (int j=0; j<n2; ++j)
			R[j] = arr[m + 1+ j];
		int i = 0, j = 0;
		int k = l;
		while (i < n1 && j < n2)
		{
			if (L[i] <= R[j])
			{
				arr[k] = L[i];
				i++;
			}
			else
			{
				arr[k] = R[j];
				j++;
			}
			k++;
		}
		while (i < n1)
		{
			arr[k] = L[i];
			i++;
			k++;
		}
		while (j < n2)
		{
			arr[k] = R[j];
			j++;
			k++;
		}
	}
	public static void sort(int arr[], int l, int r)
	{
		if (l < r)
		{
			int m = (l+r)/2;
			sort(arr, l, m);
			sort(arr , m+1, r);
			merge(arr, l, m, r);
		}
	}
	static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}
} 