Replicants’ IDs

ifnextchar ( ifnextchar (offsettrue(0pt,0pt) offsetfalse ifnextchar
[(0pt,0pt)(0pt,0pt) ifnextchar
[(0pt,0pt)(0pt,0pt)[l](0pt,0pt)(0pt,0pt)[l][] [r][image]

Los Angeles. Dr. Eldon Tyrell from Tyrell Corporation has decided to
identify each replicant with a number. He has chosen a set of prime
numbers, and has given instructions to the workers at the factory to use
as ID for a new replicant the smallest available number that can be
obtained by multiplying the numbers of the set.

Given the set of prime numbers, can you compute the ID of the m-th
replicant produced?

Input

Input consists of several cases. Every case begins with an integer
number m ≥ 1, followed by a number n, followed by n different prime
numbers. Assume 1 ≤ n ≤ 10⁴.

Output

For every case, print the ID of the m-th replicant. This number will be
smaller than 2³¹.

Problem information

Author: Albert Graells

Generation: 2026-01-25T11:45:42.582Z

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