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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class D {

    public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    public static StringTokenizer tok;

    public static int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public static long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public static String nextToken() throws IOException {
        if (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    public static final long MODUL = 1_000_000_007;

    public static long pow(long a, int degree) {
        if (degree == 0) {
            return 1;
        } else if (degree == 1) {
            return a;
        } else if (degree % 2 == 1) {
            return pow(a, degree - 1) * a % MODUL;
        } else {
            long sqrt = pow(a, degree / 2);
            return sqrt * sqrt % MODUL;
        }
    }

    public static void main(String[] args) throws IOException {
        int m = nextInt();
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < m; i++) {
            int p = nextInt();
            if (!map.containsKey(p)) {
                map.put(p, 1);
            } else {
                map.put(p, map.get(p) + 1);
            }
        }

        int n = map.size();
        long[] p = new long[n];
        int[] q = new int[n];
        int index = 0;
        for (Map.Entry<Integer, Integer> entry: map.entrySet()) {
            p[index] = entry.getKey();
            q[index] = entry.getValue();
            index++;
        }

        index = -1;
        for (int i = 0; i < n; i++) {
            if (index == -1 && q[i] % 2 == 1) {
                index = i;
            }
        }

        long result = 1;
        for (int i = 0; i < n; i++) {
            long subresult = 0;
            if (index == -1) {
                subresult = pow(p[i], q[i] / 2);
            } else {
                subresult = pow(p[i], q[i]);
            }
            result = result * subresult % MODUL;
        }
        for (int i = 0; i < n; i++) {
            if (i == index) {
                result = pow(result, (q[i] + 1) / 2);
            } else {
                result = pow(result, q[i] + 1);
            }
        }
        System.out.println(result);
    }
}