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.
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    final long mod = 1000000007;

    long quick_pow(long base, long n) {
        long ans = 1;
        long multi = base;
        while (n > 0) {
            if ((n & 1) == 1) {
                ans *= multi;
                ans %= mod;
            }
            n >>= 1;
            multi *= multi;
            multi %= mod;
        }
        return ans;
    }

    final int maxn = 200010;

    int p[];
    long primes[];
    long cnt[];

    int tot = 0;

    void init() {
        p = new int[maxn];
        primes = new long[maxn];
        cnt = new long[maxn];
    }

    void solve() {
        init();
        Scanner scan = new Scanner(new BufferedInputStream(System.in));
        int n = scan.nextInt();

        long ans = 1;
        for (int i = 1; i <= n; i++) {
            // scanf("%d",&p[i]);
            p[i] = scan.nextInt();
            cnt[p[i]]++;
        }

        for (int i = 1; i <= 200000; i++) {
            if (cnt[i] != 0) {
                primes[tot] = i;
                cnt[tot] = cnt[i];
                tot++;
            }
        }

        long product = 1;
        int s = 0;
        boolean flag = true;
        for (int i = 0; i < tot; i++) {
            product *= (cnt[i] + 1);
            if (flag && (product & 1) == 0) {
                product >>= 1;
                flag = false;
            }
            product %= (mod - 1);
        }

        for (int i = 0; i < tot; i++) {
            if (flag)
                cnt[i] >>= 1;
            long tmp = cnt[i];
            tmp *= product;
            long cur = quick_pow(primes[i], tmp);
            ans *= cur;
            ans %= mod;
        }

        System.out.println(ans);
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        new Main().solve();
    }
}
