Now Flash is in  serious trouble. Both Reverse_flash and Zoom are on their way to attack him. But Flash's energy is not enough to face them. Our all time genius Harrison Wells had created a replica mixture and gave it to Flash. Now Flash got 'N' replicas of himself including him. This would have helped him to face them with the help of his replicas. But due to some chemical contamination all the replicas including original Flash were given a specific  time interval to attack. They could face Reverse_flash and Zoom only if they(replicas) attack in unity.
Now to test their attacks the replicas have already started attacks at t=0; Now your task is to guess the next time , other than t=0, when all the replicas could attack at once . So that you could ask Zoom and his friend to attack at that particular time :)
Input constraints
1st line --> T (1 ≤ T ≤ 10) =Test cases
T test cases follow:
1st line -->Integer 'N' (1 ≤ N ≤ 1000) denoting the total no. of replicas including Original Flash.
Next line contains N space separated integers denoting the time intervals 'ti' (1 ≤ ti ≤ 10000) of attacks of N replicas(including Flash).
Output constraints
T lines --> each containing one integer denoting the answer to the above ques(modulo 1000000007).

SAMPLE INPUT
1
4
1 2 3 1

SAMPLE OUTPUT
6

Explanation

There are 4 Replicas including Flash.
The attack started at t=0 i.e, everyone attacked at once for once.
Now for everyone will be able to attack again at once only at t=6. Find it yourself.
from fractions import gcd

n=input()
for i in range(0,n):
    x=input()
    li=raw_input()
    li=map(int,li.split(" "))
    li=(set(li))
    li=sorted(li)
    lcm=1
    for j in li:
        x=gcd(lcm,j)
        lcm=(lcm*j)/x
    print(lcm%1000000007)