아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Sum Mod Pair of A

시간 제한1.5초메모리 제한1024 MB

요약
배열에 합 모듈러 쌍 연산을 K번 적용해 얻은 배열의 모든 원소 합을 998244353으로 나눈 나머지를 구합니다.
난이도

보통10점 중 7점

유형
수학, 조합론, 비트 연산
정답자
아직 제출이 없습니다

문제

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 N−1N - 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 N2−1N^2-1) where its iith element is (A_x+A_y) mod M(A\_x+A\_y) \bmod M with x=⌊i/N⌋x = \lfloor i/N \rfloor and y=i mod Ny = 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 SMPAK−1(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 (1≤N≤100,0001 ≤ N ≤ 100\\,000; M∈20,21,…,218M ∈ \\{2^0 , 2^1 , \dots , 2^{18}\\}; 1≤K≤1091 ≤ 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 (0≤A_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.

예제3

  1. 예제 1

    입력
    3 8 1
    0 1 2
    
    예상 출력
    18
    
  2. 예제 2

    입력
    3 8 2
    0 1 2
    
    예상 출력
    316
    
  3. 예제 3

    입력
    5 8192 3
    1000 2000 3000 4000 5000
    
    예상 출력
    577938879