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.
MOD = 1000000007

def modexp(base, exp):
    result = 1;
    while exp > 0:
        if exp & 1:
            result = (result * base) % MOD
        base = (base * base) % MOD
        exp >>= 1
    return result

def main(p):
  number = 1
  counter = {}

  for pi in p:
    if pi in counter:
        counter[pi] += 1
    else:
        counter[pi] = 1
    number *= pi
    number %= MOD

  #print number

  numdiv = 1
  perfectsquare = True
  sqrt = 1
  for k in counter:
      e = counter[k]
      if e % 2:
          perfectsquare = False
      else:
          sqrt *= k ** (e / 2)
          sqrt %= MOD
      numdiv *= e + 1

#  print modexp(number, numdiv / 2)
#print pow(number, numdiv / 2) % MOD

  prod1 = modexp(number, numdiv / 2)
  if perfectsquare:
      prod1 *= sqrt
      prod1 %= MOD
  print prod1

#  prod2 = 1
#  for i in range(1, number+1):
#      if number % i == 0:
#          prod2 *= i
#  prod2 %= MOD
#  if prod1 != prod2:
#      print p, number, prod1, prod2



m = int(raw_input())
p = [int(i) for i in raw_input().split(" ")]

main(p)

#main([2, 2, 2])
#main([2, 2, 3])
#main([2, 3, 3])
#main([2, 3, 5])
#main([2, 19])
#main([17, 17, 19])
#main([17, 19, 19])

#main([2, 3, 5, 17, 17, 17, 19, 19, 19, 19, 19, 19])
#main([2, 3, 3, 3, 5, 5, 5, 5])
#main([3, 3, 3, 3])


