The largest product of numbers in a sequence
Hard
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
You are given a set of numbers. Your task is to find the maximum possible product that can be obtained by multiplying exactly numbers from this set.
Input
The input consists of two lines:
The first line contains two space-separated integers, and , where and .
The second line contains space-separated integers, each in the range .
Output
Print the maximum product that can be achieved by selecting exactly numbers from the given set.
Examples
Input #1
Answer #1
Submissions 414
Acceptance rate 11%