You are given a sequence a_0 a_1 \ldots a_{N-1} of digits and a prime number . For each i \leq j with a_i \neq 0, the subsequence a_i a_{i+1} \ldots a_j can be read as a decimal representation of a positive integer. Subsequences with leading zeros are not considered. Your task is to count the number of pairs such that the corresponding subsequence is a multiple of .
The input consists of at most datasets. Each dataset is represented by a line containing four integers , , , and , separated by spaces, where 1 \leq N \leq 10^5, 1 \leq S \leq 10^9, 1 \leq W \leq 10^9, and is a prime number less than 10^8. The sequence a_0 \ldots a_{N-1} of length is generated by the following code, in which a_i is written as .
Пример 1