Minimum Product

All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
You are given a array A of N positive integers, and you can perform the following operation on the array
1) Pick any two indices i and j in the array
2) Divide A[i] and A[j] by some common factor of A[i] and A[j]
You can perform the above operation as many number of times as you want, and the aim is to minimize the product of the resulting array. Find this minimum product. Since the answer can be a large number, print the product modulo 1000000007 (10^{9}+7).
INPUT:
First line contains T, number of testcases. Each testcase contains 2 lines.
First line of each testcase contains single integer N, size of the array
Second line of each testcase contains N space separated integers, the array A
OUTPUT:
For each testcase, output single line indicating the answer to that testcase
CONSTRAINTS:
1<=T<=10
30 points : 1<=N<=2000, 1<=A[i]<=10^{6}
70 points : 1<=N<=20000, 1<=A[i]<=10^{8}
SAMPLE INPUT:
1
3
2 3 6
SAMPLE OUTPUT:
1
EXPLANATION:
First divide first and third numbers by 2, then the second and third by 3. This makes all numbers equal to 1, hence the product is 1.
Author:  piyushkumar 
Tester:  balajiganapath 
Editorial  http://discuss.codechef.com/problems/MPROD 
Tags  easy greedy ltime11 piyushkumar 
Date Added:  20042014 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.4, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 