You are given a 1-D array of size . You are required to create a square matrix of size . The creation of a matrix is done by selecting first elements from the array for the first row of the matrix, then next elements for the second row and this goes up to for row. There is also a possibility that some elements of the array may not be used for creating a square matrix. You are also given an integer , you have to circularly right shift the array by one for times and for every shifting, a new array or better say new square matrix is formed. After shifting for times, you come up with total square matrices.
For example, if the given array is and the value of is 2. The size of the square matrix is i.e. .
An initial square matrix is defined as .
For , we need to circularly right shift array by one twice. Therefore, after the first circular right shift, the array becomes and the new square matrix is defined as .
Similarly, after the second circular right shift, the array becomes and the square matrix is defined as .
Now, you are required to determine the multiplication of these matrices and print the sum of resultant elements of the square matrix.
Since answer can be large, print it modulo .
Input format
Output format
Print an integer that denotes the sum of all the elements of the resultant matrix. Since answer may be large, print it modulo .
Constraints
Matrix, as is defined in problem statement.
ans sum of elements of and is defined as Therefore ans is calculated as .