#P3193. [HNOI2008] GT考试

[HNOI2008] GT考试

Description

Ashen is preparing to register for the GT Exam. His examinee number is an NN-digit sequence X1,X2Xn (0Xi9)X_1,X_2…X_n\ (0\le X_i\le 9), and he does not want any unlucky number to appear in it. His unlucky number is an MM-digit sequence A1,A2,,Am (0Ai9)A_1,A_2,\cdots, A_m\ (0\le A_i\le 9). “Does not appear” means that in X1,X2XnX_1,X_2\cdots X_n there is no contiguous segment exactly equal to A1,A2,,AmA_1,A_2,\cdots ,A_m. Both A1A_1 and X1X_1 may be 00.

Input Format

The first line contains N,M,KN,M,K. The next line contains an MM-digit number.

Output Format

Ashen wants to know how many examinee numbers do not contain the unlucky number. Output the result modulo KK.

4 3 100
111
81

Hint

Constraints

For all testdata, N109N\leq10^9, M20M\leq 20, K10000K\leq10000.

Translated by ChatGPT 5