Least common multiple

Write a program such that, given nn strictly positive natural numbers x1xnx_1 \dots x_n, prints their least common multiple greater than zero.

Input

Input consists of several cases. Each case begins with a number n1n \ge 1, followed by x1xnx_1 \dots x_n. A special case with n=0n = 0 marks the end of input.

Output

For every case, print in a line the least common multiple greater than zero of x1xnx_1 \dots x_n. For the given cases, this number will always be between 1 and 10910^9.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:11:43.887Z

© Jutge.org, 2006–2026.
https://jutge.org