#K57562. Maximum Cookies Merge

    ID: 30448 Type: Default 1000ms 256MiB

Maximum Cookies Merge

Maximum Cookies Merge

You are given \(T\) test cases. In each test case, you are provided with an integer \(N\), followed by \(N\) integers where each integer represents the number of cookies of a specific type.

Your task is to merge all cookie types into one type by performing a series of operations. In each operation, you merge two different types of cookies; although this operation consumes both types, the number of new cookies obtained is equal to the product of the two cookie counts. Ultimately, after merging all the cookie types, the maximum number of cookies obtainable is given by:

$$ \prod_{i=1}^{N} a_i $$

Calculate this product for each given test case.

inputFormat

The first line contains an integer (T), the number of test cases. For each test case, the first line contains an integer (N), representing the number of cookie types. The next line contains (N) space-separated integers, each denoting the number of cookies of that type.

outputFormat

For each test case, output a single line containing the maximum number of cookies obtainable after merging all cookie types.## sample

2
3 2 3 4
4 1 1 1 1
24

1

</p>