from math import lcm T=int(input()) for _ in range(T): N=int(input()) A=list(map(list,input().split())) for i in range(N): while len(A[i])>1 and A[i][-1]=="0": A[i].pop() A[i]="".join(A[i]) ans=1 tmp=[] for a in A[1:]: mn=int(a[-1]) x=1 while (mn*x)%10!=0: x+=1 x*=10**(len(a)-1) tmp.append(x) print(lcm(*tmp))