You are given an array A of n integers and an integer k. From the array A, a new array B of size n×k is obtained by concatenating the array A, k times. For example, if A=[2,3,2] and k=2, then B=[2,3,2,2,3,2].
In a step, one of the elements is randomly removed from B. For example, if B=[2,3,2] then after one step, B could be [2,3] or [2,2] or [3,2]. Let E[i] be the expected value of the number of inversions in B after i steps. An inversion is defined as the number of pairs of indices i,j such that i<j and B[i]>B[j]. Find the value of n×k∑i=0 E[i] modulo 109+7. It's guaranteed that the answer can be represented as rational fraction PQ where gcd(P,Q)=1 , so print the value P.Q−1mod109+7.
There are multiple test cases in a single input file.
Input format
Output format
For each test case, print the answer in a new line.
Constraints
1≤t≤105
1≤t∑i=1 ni≤3∗105
1≤ni×ki≤109
1≤A[i]≤n
-