#include <iostream>
using namespace std;
int nww(int *tab, int m,int y);
int maximum;
int main()
{
int x,y;
cin>>x;
while(x--)
{
cin>>y;
int *tab=new int [y];
for(int i=0; i<y; i++)
{
cin>>tab[i];
}
maximum=tab[0];
for(int i=1; i<y; i++)
{
if(tab[i]>maximum)
{
maximum=tab[i];
}
}
// Do tego momentu raczej jest ok.
cout<<nww(tab,maximum,y)<<endl;
delete [] tab;
}
return 0;
}
int nww(int *tab,int m,int y)
{
int poz=0;
for(int i=0; i<y; i++)
{
if(m%tab[i]==0)
poz=1;
else
{
poz=0;
i=y;// z checia zamienil bym na break, jezeli ktos wie jak
}
}
if(poz==1)
return m;
return nww(tab,m+maximum,y);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG53dyhpbnQgKnRhYiwgaW50IG0saW50IHkpOwoKaW50IG1heGltdW07CgppbnQgbWFpbigpCnsKCiAgICBpbnQgeCx5OwogICAgY2luPj54OwoKICAgIHdoaWxlKHgtLSkKICAgIHsKICAgICAgICBjaW4+Pnk7CiAgICAgICAgaW50ICp0YWI9bmV3IGludCBbeV07CgoKICAgICAgICBmb3IoaW50IGk9MDsgaTx5OyBpKyspCiAgICAgICAgewogICAgICAgICAgICBjaW4+PnRhYltpXTsKICAgICAgICB9CiAgICAgICAgbWF4aW11bT10YWJbMF07CiAgICAgICAgCiAgICAgICAgZm9yKGludCBpPTE7IGk8eTsgaSsrKQogICAgICAgIHsKICAgICAgICAgICAgaWYodGFiW2ldPm1heGltdW0pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIG1heGltdW09dGFiW2ldOwogICAgICAgICAgICB9CiAgICAgICAgfQovLyBEbyB0ZWdvIG1vbWVudHUgcmFjemVqIGplc3Qgb2suCgogICAgICAgIGNvdXQ8PG53dyh0YWIsbWF4aW11bSx5KTw8ZW5kbDsKICAgICAgICBkZWxldGUgW10gdGFiOwoKICAgIH0KICAgIHJldHVybiAwOwp9CgppbnQgIG53dyhpbnQgKnRhYixpbnQgbSxpbnQgeSkKewogICAgaW50IHBvej0wOwoKICAgIGZvcihpbnQgaT0wOyBpPHk7IGkrKykKICAgIHsKCiAgICAgICAgaWYobSV0YWJbaV09PTApCiAgICAgICAgcG96PTE7CiAgICAgICAgZWxzZQogICAgICAgIHsKICAgICAgICAgICAgcG96PTA7CiAgICAgICAgICAgIGk9eTsvLyB6IGNoZWNpYSB6YW1pZW5pbCBieW0gbmEgYnJlYWssIGplemVsaSBrdG9zIHdpZSBqYWsKICAgICAgICB9CiAgICB9CgogICAgaWYocG96PT0xKQogICAgcmV0dXJuIG07ICAKICAgIHJldHVybiBud3codGFiLG0rbWF4aW11bSx5KTsKCgp9Cg==