560A.md (1091B)
1 Source: https://codeforces.com/problemset/problem/560/A 2 3 A. Currency System in Geraldion 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of each value. Such sum is called unfortunate. Gerald wondered: what is the minimum unfortunate sum? 22 23 Input 24 25 The first line contains number *n* (1 ≤ *n* ≤ 1000) — the number of values of the banknotes that used in Geraldion. 26 27 The second line contains *n* distinct space-separated numbers *a*1, *a*2, ..., *a**n* (1 ≤ *a**i* ≤ 106) — the values of the banknotes. 28 29 Output 30 31 Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. 32 33 Examples 34 35 Input 36 37 ``` 38 5 39 1 2 3 4 5 40 ``` 41 42 Output 43 44 ``` 45 -1 46 ```