PAYPAL OA DON'T KNOW ANSWER
Anonymous User
262

You are given an array A of N elements where each element is between 0 and 9
you want to build a number of M digits such that for each digit you choose a number 1 between 1 and N and make the digital equal to Ai. Additionally you are given two numbers Mod and X

Find the total number of ways to build a number u where (u modulo Mod)= X since the answer can be large return it modulo 10^9+7

Input format:
the first line contains an integer N denoting the number of elements in A
the next line contains an integer M denoting the number of digits
the next line contains an integer, MOD denoting the value Mod described in the problem
Each line i ofthe N subsequent lines(where 0<=i<N) contiains an interger describing A[i]

Constraints
1 <= N <= 10^5
1 M = 10^9
1<=MOD <= 100
1 = X <= MOD-1
0 <= A[i] <= 9

input:
2
2
7
6
4
1
output:
1
the only way is to choose the first digit from the left equals to A1 and the second digit equals A2 so the number is 41 and its modulo on 7 is 6

Comments (1)