|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||256 MB||0||0||0||0.000%|
Let x1 < x2 < … < xn be positive integers and let x1 and x2 be relatively prime (i.e. the only positive integer that evenly divides both of them is 1).
We consider all infinite sequences of integers, which are strictly increasing with first member 0, for which the difference between any two adjacent members is equal to one of the integers x1, x2, …, xn. For example, if n = 2, x1 = 4 and x2 = 7, then the first nine members of such a sequence are possible to be 0, 4, 8, 15, 19, 26, 33, 40, 44.
Write program sequence that determines the largest integer that cannot be found in any of these sequences.
The integer n (1 < n < 6) is given on the first line of the standard input. There are n integers on the second line: x1, x2, …, xn.
On a line of the standard output the program have to write the sought integer.
2 4 7