//错了2次 本以为没考虑 公倍数是0的结果
//_int32 是long而不是int 哦
#include<stdio.h>
long f(long a,long b){
long temp,r;
if(a<b)
{
temp=a;
a=b;
b=temp;
}
r=a%b;
while(r!=0)
{
a=b;
b=r;
r=a%b;
}
return b;
}
int main()
{
long n,i,s,c,t;
scanf("%ld",&n);
while(n-->0)
{
scanf("%ld",&s);
if(s!=0)
scanf("%ld",&t);
else
t=0;
for(i=2;i<=s;i++)
{
scanf("%ld",&c);
if(t==0)
continue;
if(c==0)
t=0;
else
t=(t*c)/f(t,c);
}
printf("%ld\n",t);
}
return 0;
}