Least common multiple

Your task is to write a program such that, given nn strictly positive natural numbers x1,,xnx_1,\dots,x_n, prints their least common multiple greater than zero.

Input

The input consists of zero or more cases. Each case consists of two lines: the first one with a natural n1n\ge 1; the second one with x1,,xnx_1,\dots,x_n. A special line with n=0n = 0 indicates the end of the input.

Output

For each case of the input, your program must print in a line the least strictly positive common multiple of x1,,xnx_1,\dots,x_n.

Observation

Use the function |gcd()| of the exercise MCD3.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:12:20.368Z

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