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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
 
 public class realfast implements Runnable {
    private static final int INF = (int) 1e9;
    long in= (long)Math.pow(10,9)+7;
    public  void solve() throws IOException 
    {

        boolean prime []= new boolean[200010];

        Arrays.fill(prime,true);
        prime[0]=false;
        prime[1]=false;
        for(int i=2;i<=200000;i++)
        {
          if(prime[i])
          {
           for(int j=2*i;j<=200000;j=j+i)
           {
             prime[j]=false;
           }
          }
        }
        int count[]= new int [200001];
        int m = readInt();
        for(int i =0;i<m;i++)
        {
            int a = readInt();
            count[a]++;
        }

        long fin[]= new long[200001];

        for(int i =2;i<=200000;i++)
        {
           if(prime[i])
           {
             for(int j=i;j<=200000;j=j+i)
             {
                 int cou=0;
                 int j1=j;
                 while(j1%i==0)
                 {
                     j1=j1/i;
                     cou++;
                 }
                 fin[i]= fin[i]+ cou*(count[j]);
             }
           }
        }
       

        long clause=1;
        long mul =1;
        
        for(int i=2;i<=200000;i++)
        {
           if(prime[i])
           {
               long coun = (fin[i])*(fin[i]+1);
               coun=coun/2;
               coun=coun%(in-1);
               clause = clause%(in-1);
               coun = (coun*clause)%(in-1);

               mul = pow(mul%in,fin[i]+1)%in;

               long val = pow(i,coun)%(in);
               mul = (mul*val)%in;
               
               clause = (clause*(fin[i]+1))%(in-1);
           }
        }

        out.println(mul);
        
     
    }  
    public long pow(long a , long p)
    {
      if(p==0)
        return 1;
      long value = pow(a,p/2)%in;
      value=(value*value)%in;
      if(p%2==0)
        return value;
      else
        return (value*a)%in;
    }
   
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public static void main(String[] args) {
        new Thread(null, new realfast(), "", 128 * (1L << 20)).start();
    }
 
    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    private BufferedReader reader;
    private StringTokenizer tokenizer;
    private PrintWriter out;
 
    @Override
    public void run() {
        try {
            if (ONLINE_JUDGE || !new File("input.txt").exists()) {
                reader = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                reader = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            }
            solve();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                reader.close();
            } catch (IOException e) {
                // nothing
            }
            out.close();
        }
    }
 
    private String readString() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
 
    @SuppressWarnings("unused")
    private int readInt() throws IOException {
        return Integer.parseInt(readString());
    }
 
    @SuppressWarnings("unused")
    private long readLong() throws IOException {
        return Long.parseLong(readString());
    }
 
    @SuppressWarnings("unused")
    private double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }
}
class edge implements Comparable<edge>{
    int u ;
    int v ;
    int val;
    edge(int u1, int v1 , int val1)
    {
       this.u=u1;
       this.v=v1;
       this.val=val1;
    }
    public int compareTo(edge e)
    {
        return this.val-e.val;
    }
}
