#000248

Hobbit

Hobbit Frodo must accomplish a noble and difficult mission, he must destroy a magic and wicked ring. In this quest, he must travel to a dangerous place called Modor and throw the ring into a crevice of fire. He has left home for some time and is currently following a straight and quite long road that has bushes from place to place. Being very tired Frodo thinks he would better have some rest. The only safe place along the road is a bush the position of which can be computed using a magic formula that uses the value P that is the product of the distances between pairs of adjacent bushes along the road. Unfortunately what Frodo knows are only the distances between every pair of bushes along the road and the magic formula, but he doesn't know the value of P. Can you help him in this respect?

It is known that there are at least two bushes and at most 1000 bushes along the road. Moreover, the value of P cannot exceed 10^9.



InputThe first line contains the number of distances N. The next line contains N space separated integers representing the distances.


OutputPrint the value of P. If there is no solution, print -1.


Input:6
1 2 2 3 3 5

Output:4


Input:3
1 2 2

Output:-1

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.