logo AlgoBeat OnlineJudge
登录 注册

#216988. [ICPC 2025 Shanghai R] Flower' s land 3

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

There is a binary string of length stored on disk .

Then, there are operations. In the -th operation, a disk is chosen, and the string on that disk is copied to disk , producing . However, during the copying process, up to bits may be flipped (i.e., errors occur in at most positions).

You are given all the final binary strings , each of length . Your task is to determine how many possible sequences could result in this final configuration.

Since the answer can be large, you only need to find the answer modulo .

输入格式

The first line of the input contains three integers , , (, , ), described in the statement. It is guaranteed that is a multiple of .

Each of the next lines contains a hexadecimal string of length . Each character of is one of - or -, where , , , .

Each bit in the hexadecimal representation corresponds to consecutive bits in the binary string . Specifically, for each bit , it can be proved that there exists a unique tuple satisfying and . Bits in the binary string satisfy .

输出格式

Print an integer — the number of valid sequences modulo .

样例

样例输入 1

5 8 2
95
05
BD
9C
BD

样例输出 1

6