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.*;
import java.util.*;
import java.math.BigInteger;
import java.util.Map.Entry;

import static java.lang.Math.*;

public class D extends PrintWriter {

    final long mod = 1_000_000_000 + 7;

    void run() {

        int n = nextInt(), m = 200000;

        int[] p = new int[m];
        for (int i = 0; i < n; i++) {
            ++p[nextInt()];
        }

        boolean e = true;

        for (int i = 2; e && i < m; i++) {
            if (p[i] % 2 == 1) {
                e = false;
            }
        }

        long num = 1;

        for (int i = 2; i < m; i++) {
            if (e) {
                num = (num * pow(i, p[i] / 2)) % mod;
            } else {
                num = (num * pow(i, p[i])) % mod;
            }
        }
        long order = 0;
        {
            long a = 2;
            long b = (mod - 1) / a;

            if (pow(num, a) == 1) {
                order = a;
            } else {
                if (pow(num, b) == 1) {
                    order = b;
                } else {
                    if (pow(num, a * b) == 1) {
                        order = a * b;
                    } else {
                        throw new RuntimeException("WTF");
                    }

                }
            }
        }
        long d = 1;

        for (int i = 2; i < m; i++) {
            int a = p[i] + 1;

            if (!e && (a % 2 == 0)) {
                a /= 2;
                e = true;
            }

            d = (d * a) % order;
        }

        println(pow(num, d));

    }

    long pow(long a, long b) {
        long c = 1;

        for (; b > 0; b >>= 1) {
            if ((b & 1) > 0) {
                c = (c * a) % mod;
            }
            a = (a * a) % mod;
        }

        return c;
    }

    void skip() {
        while (hasNext()) {
            next();
        }
    }

    int[][] nextMatrix(int n, int m) {
        int[][] matrix = new int[n][m];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                matrix[i][j] = nextInt();
        return matrix;
    }

    String next() {
        while (!tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(nextLine());
        return tokenizer.nextToken();
    }

    boolean hasNext() {
        while (!tokenizer.hasMoreTokens()) {
            String line = nextLine();
            if (line == null) {
                return false;
            }
            tokenizer = new StringTokenizer(line);
        }
        return true;
    }

    int[] nextArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = nextInt();
        }
        return array;
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException err) {
            return null;
        }
    }

    public D(OutputStream outputStream) {
        super(outputStream);
    }

    static BufferedReader reader;
    static StringTokenizer tokenizer = new StringTokenizer("");
    static Random rnd = new Random();
    static boolean OJ;

    public static void main(String[] args) throws IOException {
        OJ = System.getProperty("ONLINE_JUDGE") != null;
        D solution = new D(System.out);
        if (OJ) {
            reader = new BufferedReader(new InputStreamReader(System.in));
            solution.run();
        } else {
            reader = new BufferedReader(new FileReader(new File(D.class.getName() + ".txt")));
            long timeout = System.currentTimeMillis();
            while (solution.hasNext()) {
                solution.run();
                solution.println();
                solution.println("----------------------------------");
            }
            solution.println("time: " + (System.currentTimeMillis() - timeout));
        }
        solution.close();
        reader.close();
    }
}