TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Kelvin loves large number.

He likes his height being a large number.

He likes his income being a large number.

He likes his number of girlfriends being a large number... no, maybe not.

Anyway, so when he stares at a list of numbers, he can't help multiplying some of them together to obtain a large number.

Now he is staring at some N numbers, he wonders if he multiply some (at least one) of them together, how large at most can the product be?

Input Format

One the first line is the integer T, indicating the number of testcases.

In each testcase, the testcase starts with a number N, being the amount of numbers in the list. Then cames the N numbers ai in the list.

T <= 100

N <= 2000

|ai| <= 10000

Output Format

For each testcase, output a number in a line indicating the maximum product Kelvin can get by multiplying some of the numbers (at least one) in the list together.

Sample Input 1

3
4
10000 10000 10000 10000
3
-1 -2 -3
6
1 -2 3 -4 5 -6

Sample Output 1

10000000000000000
6
360

Hints

Problem Source

Migrated from old NTUJ.

kelvin

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 2000