Archery

3.3

29 votes
Approved, Easy, Math, Number theory
Problem

N archers are shooting arrows at targets. There are infinite targets numbered starting with 1. The ith archer shoots at all targets that are multiples of ki.

Find the smallest target that is hit by all the archers.

Input

The first line contains an integer T - the total no. of testc ases.

T test cases follow. Each test case is of the following format:

The first line contains a natural number - N - the number of archers. The second line contains N space-separated integers, where the ith integer denotes the value of ki for the ith archer.

Output

For each test case, print the smallest target that is hit by all archers on a new line.

Constraints

1T5

1N15

1ki48

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

The first archer shoots at targets 2, 4, 6, 8, 10, 12, 14, ...

The second archer shoots at targets 3, 6, 9, 12, ...

The third archer shoots at targets 4, 8, 12, 16, 20, ...

The smallest target at which all archers shoot is 12.

Editor Image

?