Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Lord of the Ring
Time Limit: 1000MSMemory Limit: 10000K
Total Submissions: 691Accepted: 201

Description

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?

Input

The program input is from a std input. Each data set in the input for a particular set of distances between pairs of bushes on the road Frodo is traveling along. Each data set starts with the number of distances followed by the distances in nondecreasing order. White spaces can occur freely in the input.
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.

Output

For each set of data the program computes the value of P to the standard output from the beginning of a separate line. If P cannot be computed from the data set the output is "No solution".

Sample Input

6
1 2  2   3  3 5

3
1 2 2 

Sample Output

4
No solution

Hint

The second data does not accept a solution. The bush positions along the road cannot be deduced from the data and therefore the distances between adjacent points cannot be computed.

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator