Metrognome
Let me tell you, getting garden gnomes to dance in sync while listening to Moonlight Sonata is no easy task. The best we can hope for is that the garden gnomes eventually all line up on a single beat or two (since all garden gnomes dance at their own pace). More specifically, each garden gnome, , has a certain value, . At each integer multiple of , the garden gnome will perform a dance move. Your task is to find out, for a given set of garden gnomes: what is the first point in time at which all the garden gnomes perform a dance move simultaneously?
Input
The input begins with the number , the number of test cases to follow. For each of the following test cases, a line with a single integer , the number of garden gnomes, will appear. The next line will consist of n space-separated integers .
Output
For each of the t test cases, print out a single integer: the first point in time during which all garden gnomes are dancing simultaneously. An answer is guaranteed to exist. Do not print trailing whitespace characters following and/or in between test cases.
Input Samples | Output Samples |
---|---|
3
5 1 2 3 4 5 2 1 2 3 7 8 3 |
60
2 168 |