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 int N = 200010;
const int inf = 1e9;
const int MOD = 1e9 + 7;
struct Number {
  int x, p;
  Number(){};
  Number(int x, int p) : x(x), p(p){};
};
int n, m, p[N], cnt[N], cPref[N], cSuf[N];
Number a[N];
int product(int a, int b, int MOD) { return (1ll * a * b) % MOD; }
void mult(int &a, int b, int MOD) { a = (1ll * a * b) % MOD; }
int power(int b, int p, int MOD) {
  int res = 1;
  while (p) {
    if (p & 1) mult(res, b, MOD);
    mult(b, b, MOD);
    p /= 2;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) cnt[p[i]]++;
  m = 0;
  for (int i = 1; i < N; i++)
    if (cnt[i] > 0) {
      a[++m] = Number(i, cnt[i]);
    }
  cPref[1] = a[1].p + 1;
  for (int i = 2; i <= m; i++)
    cPref[i] = product(cPref[i - 1], a[i].p + 1, MOD - 1);
  cSuf[m] = a[m].p + 1;
  for (int i = m - 1; i >= 1; i--)
    cSuf[i] = product(cSuf[i + 1], a[i].p + 1, MOD - 1);
  int ans = 1;
  for (int i = 1; i <= m; i++) {
    int val = 1;
    int tmp = 1;
    for (int j = 0; j <= a[i].p; j++) {
      mult(val, tmp, MOD);
      mult(tmp, a[i].x, MOD);
    }
    int p;
    if (i == 1 && i == m)
      p = 1;
    else if (i == 1)
      p = cSuf[2];
    else if (i == m)
      p = cPref[i - 1];
    else
      p = product(cPref[i - 1], cSuf[i + 1], MOD - 1);
    mult(ans, power(val, p, MOD), MOD);
  }
  cout << ans;
  return 0;
}
