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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Washoum
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        inputClass in = new inputClass(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DMultipliers solver = new DMultipliers();
        solver.solve(1, in, out);
        out.close();
    }

    static class DMultipliers {
        static final int MOD = (int) 1e9 + 7;

        static int pow(long x, long y, int p) {
            long res = 1;
            x = x % p;

            while (y > 0) {
                if ((y & 1) == 1)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return (int) res;
        }

        public void solve(int testNumber, inputClass sc, PrintWriter out) {
            int m = sc.nextInt();
            long[] tab = new long[m];
            for (int i = 0; i < m; i++) {
                tab[i] = sc.nextInt();
            }
            HashMap<Long, Integer> where = new HashMap<>();
            ArrayList<ArrayList<Integer>> puis = new ArrayList<>();
            int taille = 0;
            for (int i = 0; i < m; i++) {
                if (where.get(tab[i]) == null) {
                    where.put(tab[i], taille);
                    puis.add(new ArrayList<>());
                    puis.get(taille).add((int) tab[i]);
                    puis.get(taille).add(1);
                    taille++;
                } else {
                    puis.get(where.get(tab[i])).set(1, puis.get(where.get(tab[i])).get(1) + 1);
                }
            }
            long ans = 1;
            ArrayList<Long> total = new ArrayList<>();
            HashMap<Integer, Long> done = new HashMap<>();
            long tmp;
            for (int i = 0; i < puis.size(); i++) {
                tmp = 1;
                if (done.get(puis.get(i).get(1)) == null) {
                    for (int j = 0; j < puis.size(); j++) {
                        if (i != j) {
                            tmp *= (puis.get(j).get(1) + 1);
                            tmp %= (MOD - 1);
                        }
                    }
                    done.put(puis.get(i).get(1), tmp);
                } else {
                    tmp = done.get(puis.get(i).get(1));
                }
                total.add(tmp);
            }

            for (int i = 0; i < puis.size(); i++) {
                for (int j = 1; j <= puis.get(i).get(1); j++) {
                    ans *= (long) pow(pow(puis.get(i).get(0), j, MOD), total.get(i), MOD);
                    ans %= MOD;
                }
            }
            out.println(ans);
        }

    }

    static class inputClass {
        BufferedReader br;
        StringTokenizer st;

        public inputClass(InputStream in) {

            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

    }
}

