Least common multiple for N numbers using factorization

C++ Hard math

Task «Least common multiple for N numbers using factorization»

Given N integers. It is required to find their least common multiple (LCM). To solve this, it is necessary to use the prime factorization of the numbers. Input data: first an integer N (1 ≤ N ≤ 100), then N numbers (1 ≤ each ≤ 10^6). Output a single integer — the LCM of all numbers. It is guaranteed that the answer does not exceed 10^18.

Input Format

In the first line — an integer N. In the second line — N integers separated by spaces.

Output Format

One integer — the LCM of all numbers.

Examples

Example 1

INPUT
5 1 2 3 4 5
OUTPUT
60
main.cpp