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>
#pragma GCC optimize("O3")
std::pair<int, int> DR[] = {{-1, 0}, {0, 1},   {1, 0}, {0, -1},
                            {-1, 1}, {-1, -1}, {1, 1}, {1, -1}};
using namespace std;
const long long mod = 1e9 + 7;
long long n, x, a[1 << 18], b[1 << 18], l[1 << 18], r[1 << 18];
map<long long, long long> m;
long long p(long long x, long long y) {
  long long ans = 1;
  for (long long j = 0; (1LL << j) <= y; j++) {
    if (y & (1LL << j)) ans *= x;
    x *= x;
    x %= mod;
    ans %= mod;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    m[x]++;
  }
  n = (long long)((m).size());
  long long i = 1;
  for (auto it : m) {
    a[i] = it.first;
    b[i++] = it.second;
  }
  l[0] = 1;
  r[n + 1] = 1;
  for (long long i = 1; i <= n; i++) l[i] = (l[i - 1] * (b[i] + 1)) % (mod - 1);
  for (long long i = n; i >= 1; i--) r[i] = (r[i + 1] * (b[i] + 1)) % (mod - 1);
  long long ans = 1;
  for (long long i = 1; i <= n; i++) {
    x = (b[i] * (b[i] + 1)) / 2;
    x %= mod - 1;
    x *= (l[i - 1] * r[i + 1]) % (mod - 1);
    x %= mod - 1;
    ans *= p(a[i], x);
    ans %= mod;
  }
  return cout << ans, 0;
}
