Code Submission Evaluation System Login

E4590 2018 1

Start:2018-09-15 13:00:00
End:2018-09-15 16:00:00
 

Tasks | Scoreboard | Statistics


CSES - E4590 2018 1 - DenominationsCSES - Denominations

Denominations

Time limit:1.00 s
Memory limit:512 MB

The country of Oopse has grown and it needs to produce its own currency. The Oopsians have chosen to produce coins and notes with denominations $c_1, c_2, \ldots, c_n$. Unfortunately they are not sure whether given denominations can be used to pay for products of any price.

Help Oopsians find out whether they can pay for products of any price, and if not, what is the smallest price they can't pay for. Any coin or note can be used as many times as needed.

Input

The first line of input consists of a single integer $n$, the number of denominations. The second line has $n$ integers, the denominations $c_1, c_2, \ldots, c_n$, separated by spaces.

Output

Output either the smallest price which can't be paid using the given denominations, or the string "ALL" if all products of any price can be paid.

Constraints
Example 1

Input:
2
5 6


Output:
1

Example 2

Input:
15
1 2 5 10 20 50 100 200 500 1000 2000 5000 10000 20000 50000


Output:
ALL

Explanation of example 2

The given values are all Euro denominations in cents. You can produce any amount using Euros.