Under construction

Still being built. Things may change

XOR Sum

Time limit1sMemory limit512 MB

Summary
Given n k-bit numbers, compute the sum over all pairs of (a_i XOR a_j) raised to the power x, modulo 998244353.
Level

Hard8 of 10

Topics
Bit manipulation, Math, Combinatorics
Solved
No attempts yet

Problem

You have an array of nn kk-bit numbers a1,a2,…,ana_1, a_2, \ldots, a_n.

Calculate ∑i=1n∑j=i+1n(ai⊕aj)x\sum_{i=1}^{n} \sum_{j=i+1}^{n} (a_i \oplus a_j)^x.

a⊕ba \oplus b is the bitwise exclusive OR of aa and bb.

Since the answer can be very large, output it modulo 998 244 353998\,244\,353.

Input

The first line contains three integers nn, kk, xx (1≤n,k,n⋅k≤300 0001 \leq n, k, n \cdot k \leq 300\,000, 1≤x≤31 \leq x \leq 3), the length of the array, the number of bits in each number, and the power applied to each XOR result.

Each of the next nn lines contains a string s0,s1,…,sk−1s_0, s_1, \ldots, s_{k-1} made of '0' and '1'. The ii-th string gives ai=∑i=0k−1si⋅2ia_i = \sum_{i=0}^{k-1} s_i \cdot 2^i.

Output

Print one number: the sum of the xx-th powers of the XOR results over all pairs, modulo 998 244 353998\,244\,353.

Hint

In the first sample, the array is [5,4,4][5, 4, 4], and the answer is (5⊕4)+(5⊕4)+(4⊕4)=1+1+0=2(5 \oplus 4) + (5 \oplus 4) + (4 \oplus 4) = 1 + 1 + 0 = 2.

In the second sample, the array is [61,38][61, 38], and the answer is (61⊕38)3=273=19683(61 \oplus 38)^3 = 27^3 = 19683.

Examples2

  1. Example 1

    Input
    3 3 1
    101
    001
    001
    
    Expected output
    2
    
  2. Example 2

    Input
    2 6 3
    101111
    011001
    
    Expected output
    19683