PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000033. Thời điểm các đồng hồ cùng trở về vị trí đầu (Multiple Clocks)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Thời điểm các đồng hồ cùng trở về vị trí đầu (Multiple Clocks)

Multiple Clocks

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

There are NN clocks. The hand of clock ii completes one full turn in exactly TiT_i seconds. All hands start pointing upward, and the clocks start simultaneously. Find the smallest positive number of seconds until all hands point upward again.

Input

The first line contains NN. Each of the following NN lines contains TiT_i.

Output

Print the minimum positive time.

Subtasks

  • Subtask 1 (20 points): 1≤N≤51 \le N \le 5; 1≤Ti≤1001 \le T_i \le 100; lcm⁡(T1,…,TN)≤1018\operatorname{lcm}(T_1,\ldots,T_N) \le 10^{18}
  • Subtask 2 (30 points): 1≤N≤401 \le N \le 40; 1≤Ti≤1061 \le T_i \le 10^{6}; lcm⁡(T1,…,TN)≤1018\operatorname{lcm}(T_1,\ldots,T_N) \le 10^{18}
  • Subtask 3 (50 points): 1≤N≤1001 \le N \le 100; 1≤Ti≤10181 \le T_i \le 10^{18}; lcm⁡(T1,…,TN)≤1018\operatorname{lcm}(T_1,\ldots,T_N) \le 10^{18}

Examples

Input

2
2
3

Output

6

Explanation

The first clock returns every 22 seconds and the second every 33 seconds; both first coincide at second 66.