#C6841. Maximum Product Modulo 10^9+7
Maximum Product Modulo 10^9+7
Maximum Product Modulo 10^9+7
You are given an array of N integers. Your task is to determine the maximum product of any two distinct elements in the array, and then output the product modulo \(10^9+7\).
Note: The input guarantees that the array contains at least one pair of elements when N \(\geq 2\). If N is less than 2, you should output 0. Use efficient algorithms to handle large numbers and arrays.
Example:
For an array [1, 2, 3, 4, 5], the maximum product is \(4 \times 5 = 20\), so the output is 20.
inputFormat
The first line of input contains a single integer N representing the number of elements in the array.
The second line contains N space-separated integers representing the elements of the array.
outputFormat
Output a single integer which is the maximum product of two distinct elements in the array, taken modulo \(10^9+7\).
## sample5
1 2 3 4 5
20