#K71202. Maximum Product Modulo

    ID: 33479 Type: Default 1000ms 256MiB

Maximum Product Modulo

Maximum Product Modulo

You are given an array of integers. Your task is to find the maximum product of any two distinct elements in the array, and then output the result modulo \(10^9+7\).

Input format: The first line contains a single integer \(n\) indicating the number of elements in the array. The second line contains \(n\) space-separated integers.

Output format: Print a single integer which is the maximum product of any two distinct elements in the array modulo \(10^9+7\).

Note: It is guaranteed that the array contains at least two elements.

inputFormat

The input is read from standard input (stdin) and consists of two lines. The first line contains an integer \(n\) representing the number of elements in the array. The second line contains \(n\) space separated integers.

outputFormat

The output should be written to standard output (stdout) and consist of a single integer: the maximum product of any two distinct elements in the array taken modulo \(10^9+7\).

## sample
5
1 5 3 4 2
20