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;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, cnt;
long long a[200010];
long long p[200010], rep[200010];
long long s[200010], t[200010];
long long phimod = 500000002;
long long mod2 = 500000003;
long long ans = 1;
inline long long quickpow(long long a, long long b, long long MOD) {
  long long s = 1;
  a %= MOD;
  b = b % (MOD - 1);
  while (b) {
    if (b & 1) s = (s * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return s;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++)
    if (i == 1 || a[i] != a[i - 1]) {
      p[++cnt] = a[i];
      rep[cnt] = 1;
    } else
      rep[cnt]++;
  s[0] = t[cnt + 1] = 1;
  long long pro = 1, ans2 = 1;
  for (int i = 1; i <= cnt; i++) {
    s[i] = (s[i - 1] * (rep[i] + 1)) % (1000000007 - 1);
  }
  for (int i = cnt; i >= 1; i--)
    t[i] = t[i + 1] * (rep[i] + 1) % (1000000007 - 1);
  for (int i = 1; i <= cnt; i++)
    pro = (pro * (rep[i] + 1)) % (2 * 1000000007 - 2);
  for (int i = 1; i <= cnt; i++) {
    long long ap = s[i - 1] * t[i + 1] % (1000000007 - 1);
    ans = ans *
          quickpow(p[i], pro * rep[i] / 2 % (2 * 1000000007 - 2), 1000000007) %
          1000000007;
    ans2 = ans2 *
           quickpow(p[i],
                    (rep[i] + 1) * rep[i] / 2 % (1000000007 - 1) * ap %
                        (1000000007 - 1),
                    1000000007) %
           1000000007;
    if (ans != ans2)
      printf(
          "%d %lld %lld %lld %lld\n", i, rep[i] + 1, p[i],
          pro * rep[i] / 2 % (1000000007 - 1),
          (rep[i] + 1) * rep[i] / 2 % (1000000007 - 1) * ap % (1000000007 - 1));
  }
  printf("%lld\n", ans2 % 1000000007);
}
