#K11956. Maximize Collective Strength

    ID: 23583 Type: Default 1000ms 256MiB

Maximize Collective Strength

Maximize Collective Strength

You are given a collection of M creatures, each with a positive integer strength. When two creatures battle, they merge into one creature whose strength is the product of their individual strengths. This process continues until only one creature remains. The final collective strength is simply the product of all the individual strengths.

Your task is to compute and output the maximum possible collective strength that can be achieved through these battles. Note that if there is only one creature, its strength is the answer.

Formally, if the strengths are \(a_1, a_2, \dots, a_M\), then the answer is \(\prod_{i=1}^{M} a_i\).

inputFormat

The input consists of two lines. The first line contains an integer M (1 ≤ M ≤ 1000) representing the number of creatures. The second line contains M space-separated non-negative integers, each representing the strength of a creature.

outputFormat

Output a single integer which is the product of the M strengths. This represents the maximum collective strength after all possible battles.## sample

4
2 3 5 7
210