#include <iostream>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
const ull mod=1000000007;
ull A[10009];
/*Euclidean GCD*/
ull gcd(ull a,ull b)
{
while( b != 0)
{
ull t = b;
b= a %t;
a = t;
}
return a;
}
ull lcm(ull a, ull b)
{
return (a/gcd(a,b))%mod*(b%mod);
}
ull lcms(int l ,ull * A)
{
int i;
ull result;
result = 1;
for (i = 0; i < l; i++)
result = lcm(result, A[i])%1000000007;
return result;
}
int main()
{
int T;
cin>>T;
while(T--)/*Number of test cases*/
{
int N;
cin>>N;/*How many Numbers in Array*/
for(int i=0;i<N;++i)
{
cin>>A[i];//Input Array
}
cout<<lcms(N,A)%1000000007<<endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIHVuc2lnbmVkIGxvbmcgbG9uZyB1bGw7CmNvbnN0IHVsbCBtb2Q9MTAwMDAwMDAwNzsKdWxsIEFbMTAwMDldOwovKkV1Y2xpZGVhbiBHQ0QqLwp1bGwgZ2NkKHVsbCBhLHVsbCBiKQp7CiAgICB3aGlsZSggYiAhPSAwKQoJewoJCXVsbCAgdCA9IGI7CgkJYj0gYSAldDsKCQlhID0gdDsKCX0KCXJldHVybiBhOwp9CnVsbCBsY20odWxsIGEsIHVsbCBiKSAKeyAKCXJldHVybiAoYS9nY2QoYSxiKSklbW9kKihiJW1vZCk7IAp9CnVsbCBsY21zKGludCAgbCAsdWxsICogQSkKewoJaW50ICAgICBpOwoJdWxsIHJlc3VsdDsKCXJlc3VsdCA9IDE7Cglmb3IgKGkgPSAwOyBpIDwgbDsgaSsrKSAKCQlyZXN1bHQgPSBsY20ocmVzdWx0LCBBW2ldKSUxMDAwMDAwMDA3OwoJcmV0dXJuIHJlc3VsdDsKfQppbnQgbWFpbigpCnsKCWludCBUOwoJY2luPj5UOwoJd2hpbGUoVC0tKS8qTnVtYmVyIG9mIHRlc3QgY2FzZXMqLwoJewoJCWludCBOOwoJCWNpbj4+TjsvKkhvdyBtYW55IE51bWJlcnMgaW4gQXJyYXkqLwoJCWZvcihpbnQgaT0wO2k8TjsrK2kpCgkJewoJCQljaW4+PkFbaV07Ly9JbnB1dCBBcnJheQoJCX0KCQljb3V0PDxsY21zKE4sQSklMTAwMDAwMDAwNzw8ZW5kbDsKCX0KCXJldHVybiAwOwp9