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.
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int a, b, c, d, m, n, k, tests;
long long res = 1, komb = 0;
long long Ile[200000 + 7];
bool Sito[200000 + 7];
vector<int> Primes;
vector<int> Pref;
vector<int> Suf;
void Factor(int);
long long Power(long long, long long);
int main() {
  for (int i = 2; i <= 450; i++) {
    if (Sito[i] == 0) {
      for (int j = i * i; j <= 200000 + 7; j += i) {
        Sito[j] = true;
      }
    }
  }
  for (int i = 2; i <= 200000 + 7; i++) {
    if (Sito[i] == 0) {
      Primes.push_back(i);
    }
  }
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    Factor(a);
  }
  for (int i = 0; i < (int)(Primes).size(); i++) {
    komb = (komb * Ile[Primes[i]] + komb) % (MOD - 1);
    komb = (komb + Ile[Primes[i]]) % (MOD - 1);
    Pref.push_back(komb);
  }
  komb = 0;
  for (int i = (int)(Primes).size() - 1; i >= 0; i--) {
    komb = (komb * Ile[Primes[i]] + komb) % (MOD - 1);
    komb = (komb + Ile[Primes[i]]) % (MOD - 1);
    Suf.push_back(komb);
  }
  reverse(Suf.begin(), Suf.end());
  for (int i = 0; i < (int)(Primes).size(); i++) {
    long long sum = ((Ile[Primes[i]] * (Ile[Primes[i]] + 1)) / 2) % (MOD - 1);
    long long a1 = (i == 0) ? 0 : Pref[i - 1];
    long long a2 = (i == (int)(Primes).size() - 1) ? 0 : Suf[i + 1];
    long long a3 = 0;
    if (a1 != 0 && a2 == 0)
      a3 = a1 % (MOD - 1);
    else if (a2 != 0 && a1 == 0)
      a3 = a2 % (MOD - 1);
    else
      a3 = (a1 * a2 + a1 + a2) % (MOD - 1);
    long long pow = (sum * a3 + sum) % (MOD - 1);
    res = (res * Power(Primes[i], pow)) % MOD;
  }
  printf("%lld\n", res);
}
void Factor(int x) {
  if (Sito[x] == 0) {
    Ile[x]++;
  } else {
    int l = 0;
    while (x != 1) {
      if (x % Primes[l] == 0) {
        x /= Primes[l];
        Ile[Primes[l]]++;
      } else {
        l++;
      }
    }
  }
}
long long Power(long long a, long long b) {
  long long wynik = 1;
  long long duba = a;
  do {
    if (b & 1 == 1) {
      wynik = (wynik * duba) % MOD;
    }
    duba = (duba * duba) % MOD;
  } while (b >>= 1);
  return wynik;
}
