407213: GYM102697 184 Close Product

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

184. Close Producttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
This problem is worth 10 points.

You have $$$n$$$ positive integers, and you want to find their product. However, you have to omit exactly one of the integers from the list before calculating the product. You want to find the maximum product of the list, after omitting exactly one integer from the list.

For example, given the numbers $$$2$$$, $$$4$$$, and $$$5$$$, the maximum product is $$$5$$$ * $$$4$$$ = $$$20$$$. $$$2$$$ * $$$4$$$ * $$$5$$$ is not valid, because none of the numbers were omitted.

Input

The first line of input contains a single positive integer $$$n$$$: the number of integers in the list.

The next $$$n$$$ lines each contain a single positive integer: each element of the list.

Output

Output a single positive integer $$$p$$$: the maximum possible product of all integers in the list, if you omit exactly one. The answer is guaranteed to fit inside of a 32-bit integer type.

ExamplesInput
5
3
5
6
8
10
Output
2400
Input
4
4
3
2
1
Output
24
Input
5
3
3
3
3
3
Output
81

加入题单

上一题 下一题 算法标签: