ifnextchar ( ifnextchar (offsettrue(0pt,0pt) offsetfalse ifnextchar [(0pt,0pt)(0pt,0pt) ifnextchar [(0pt,0pt)(0pt,0pt)[l](0pt,0pt)(0pt,0pt)[l][] [r]
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 -th replicant produced?
Input consists of several cases. Every case begins with an integer number , followed by a number , followed by different prime numbers. Assume .
For every case, print the ID of the -th replicant. This number will be smaller than .
Input
1 1 2 2 1 2 3 1 2 5 4 2 5 7 3 11 4 2 5 7 3 19 4 2 5 7 3
Output
2 4 8 6 14 27