The Monk wants to teach all its disciples a lesson about patience, since they are always in a hurry to do something crazy. To teach them this, he gives them a list of N numbers, which may or may not be distinct. The students are supposed to solve a simple Mathematical equation based on the array of these N numbers.
g(x) - GCD (a[ 0 ], a[ 1 ], a[ 2 ]... a[n-1] )
f(x) - (a[ 0 ] * a[ 1 ] * a[ 2 ]... * a[n-1] )

The value of the MonkQuotient is: 10^9 + 7.

The equation to be solved is: ( f(x)^g(x) ) % MonkQuotient

Input constraints:
The first line of input will contain an integer — N. The next line will contain N integers denoting the elements of the list. 

Output constraints:
Print the required answer of the equation.

Constraints:
1 ≤ N ≤ 50 
1 ≤ Ai ≤ 10^3

SAMPLE INPUT
2
2 6

SAMPLE OUTPUT
144

Explanation

Here we can see that the product of the elements of array is 12 and the GCD of the array comes out to be 2 .
Thus the answer would be 12^2 which is 144.
def gcd(x, y):
	if x % y == 0:
		return y
	else :
		return gcd(y, x % y)

def gcdArray(x):
	if x[0] < x[1]:
		out = gcd(x[1],x[0])
	else :
		out = gcd(x[0],x[1])
	for i in range(2,len(x)):
		if out < x[i] :
			out = gcd(x[i],out)
		else:
			out = gcd(out,x[i])
	return out
	
n = int(raw_input())
x = (map(int,raw_input().split(" ")))
if len(x) < 2:
	gx = x[0]
else :
	gx = gcdArray(x)
fx = 1
for i in x:
	fx = (fx * i)% 1000000007
ans = 1
while gx != 0:
	if gx % 2 == 1:
		ans = (ans * fx) % 1000000007
	fx,gx = (fx * fx) % 1000000007,gx/2
print ans