You want to unite N departments into one. Number the departments 1 to N, and let Si be the size of department i. Merging many departments at once causes too much confusion, so you repeat the operation of merging two departments into one N−1 times until a single department remains. One operation goes like this.
Merging two departments costs something. The cost depends on the method, and you know a method whose cost is Sa×Sb, so you use that one. Find the minimum total cost, and the number of distinct processes whose cost is the minimum. Two processes are distinct when comparing the recorded pairs one by one in order gives at least one differing pair.
The first line contains N, the number of departments. (1≤N≤100000)
The second line contains N natural numbers S1,S2,…,SN, the sizes of the departments, separated by spaces. Each size is between 1 and 100.
Print the minimum total cost on the first line.
Print the number of distinct processes whose cost is the minimum, modulo 1,000,000,007, on the second line.
The pair (1,2) and the pair (2,1) count as different cases.