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;
long long int mod = 1000000000 + 7;
long long int bigmod(long long int num, long long int power, long long int m) {
  if (power == 0) return 1;
  long long int x = bigmod(num, power / 2, m);
  x = (x * x) % m;
  if (power % 2 == 1) x = (x * num) % m;
  return x;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long int m, i, j, k, p;
  vector<pair<long long int, long long int>> num;
  cin >> m;
  long long int arr[m + 5];
  for (i = 0; i < m; i++) {
    cin >> arr[i];
  }
  long long int cnt = 1;
  sort(arr, arr + m);
  for (i = 1; i < m; i++) {
    if (arr[i] == arr[i - 1])
      cnt++;
    else {
      num.emplace_back(arr[i - 1], cnt);
      cnt = 1;
    }
  }
  num.emplace_back(arr[m - 1], cnt);
  vector<long long int> nod;
  long long int limit = num.size();
  long long int temp[limit + 5];
  temp[limit] = 1;
  for (i = limit - 1; i >= 0; i--)
    temp[i] = (temp[i + 1] * (num[i].second + 1)) % (mod - 1);
  long long int keep = 1;
  for (i = 0; i < limit; i++) {
    long long int mm = keep * temp[i + 1];
    mm %= mod - 1;
    nod.emplace_back(mm);
    keep *= (num[i].second + 1);
    keep %= mod - 1;
  }
  long long int ans = 1;
  for (i = 0; i < limit; i++) {
    long long int md = nod[i];
    for (j = 1; j <= num[i].second; j++) {
      keep = (md * j) % (mod - 1);
      long long int x = bigmod(num[i].first, keep, mod);
      ans *= x;
      ans %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
