Sum Mod Pair of A

아직 제출이 없습니다시간 제한1.5초메모리 제한1024 MB

문제

Jono likes arrays. Jono is quite interested in one particular type of operation on an array that he calls Sum Mod Pair of A, or SMPA for short.

Given an array of integers AA (indexed from 00 to N1N - 1) and an integer MM of a power of 22, the operation SMPA(A,M)\text{SMPA}(A, M) returns an array of size N2N^2 (indexed from 00 to N21N^2-1) where its iith element is (A_x+A_y)modM(A\_x+A\_y) \bmod M with x=i/Nx = \lfloor i/N \rfloor and y=imodNy = i \bmod N.

For example, let A_0..2=2,4,5A\_{0..2} = \\{2, 4, 5\\} and M=8M = 8. Then,

\begin{align\*} \text{SMPA}(A, M) = \\,& \\{ (A\_0 + A\_0) \bmod M,(A\_0 + A\_1) \bmod M,(A\_0 + A\_2) \bmod M, \\\ & (A\_1 + A\_0) \bmod M,(A\_1 + A\_1) \bmod M,(A\_1 + A\_2) \bmod M, \\\ & (A\_2 + A\_0) \bmod M,(A\_2 + A\_1) \bmod M,(A\_2 + A\_2) \bmod M \\} \\\ = \\,& \\{ (2 + 2) \bmod 8,(2 + 4) \bmod 8,(2 + 5) \bmod 8, \\\ & (4 + 2) \bmod 8,(4 + 4) \bmod 8,(4 + 5) \bmod 8, \\\ & (5 + 2) \bmod 8,(5 + 4) \bmod 8,(5 + 5) \bmod 8 \\} \\\ = \\,& \\{4, 6, 7, 6, 0, 1, 7, 1, 2\\} \end{align\*}

Jono is not satisfied with only one SMPA\text{SMPA} operation. He then introduces the following SMPAK\text{SMPA}^K for a positive integer KK.

SMPAK(A,M)={SMPA(A,M),if K=1 SMPAK1(SMPA(A,M),M),otherwise\text{SMPA}^K(A, M) = \begin{cases}\text{SMPA}(A, M), & \text{if }K = 1 \\\ \text{SMPA}^{K-1}(\text{SMPA}(A, M), M), & \text{otherwise}\end{cases}

For example, let A_0..1=1,2A\_{0..1} = \\{1, 2\\} and M=8M = 8.

  • SMPA1(A,M)=2,3,3,4\text{SMPA}^1 (A, M) = \\{2, 3, 3, 4\\}
  • SMPA2(A,M)=4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,0\text{SMPA}^2 (A, M) = \\{4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 0\\}
  • SMPA3(A,M)=0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,\text{SMPA}^3 (A, M) = \\{0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, \dots \\} → (256256 elements)
  • SMPA4(A,M)=0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,\text{SMPA}^4 (A, M) = \\{0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, \dots \\} → (6553665536 elements)

Jono would like to experiment with a large KK but, as you might already notice, the array size grows exponentially. Therefore, he cannot simply print out the resulting array. Instead, he will be satisfied if he knows the sum of all elements in the resulting array. As this number can be very large as well, he decides to modulo the output by 998,244,353998\\,244\\,353.

Your task in this problem is to compute the sum of all elements in the array produced by SMPAK(A,M)\text{SMPA}^K(A, M). Output the non-negative remainder after being divided by 998,244,353998\\,244\\,353.

입력

Input begins with a line containing three integers NN MM KK (1N100,0001 ≤ N ≤ 100\\,000; M20,21,,218M ∈ \\{2^0 , 2^1 , \dots , 2^{18}\\}; 1K1091 ≤ K ≤ 10^9) representing the size of array AA, and the parameter MM and KK for the SMPAK(A,M)\text{SMPA}^K(A, M) operation, respectively. The next line contains NN integers A_iA\_i (0A_i<M0 ≤ A\_i < M) representing the array AA.

출력

Output contains an integer in a line representing the non-negative remainder of the sum of all elements in SMPAK(A,M)\text{SMPA}^K(A, M) after being divided by 998,244,353998\\,244\\,353.