There are b blocks of digits. Each one consisting of the same n digits, which are given to you in the input. Wet Shark must choose exactly one digit from each block and concatenate all of those digits together to form one large integer. For example, if he chooses digit 1 from the first block and digit 2 from the second block, he gets the integer 12. 

Wet Shark then takes this number modulo x. Please, tell him how many ways he can choose one digit from each block so that he gets exactly k as the final result. As this number may be too large, print it modulo 10^9 + 7.

Note, that the number of ways to choose some digit in the block is equal to the number of it's occurrences. For example, there are 3 ways to choose digit 5 from block 3 5 6 7 8 9 5 1 1 1 1 5.


-----Input-----

The first line of the input contains four space-separated integers, n, b, k and x (2 ≤ n ≤ 50 000, 1 ≤ b ≤ 10^9, 0 ≤ k < x ≤ 100, x ≥ 2) — the number of digits in one block, the number of blocks, interesting remainder modulo x and modulo x itself.

The next line contains n space separated integers a_{i} (1 ≤ a_{i} ≤ 9), that give the digits contained in each block.


-----Output-----

Print the number of ways to pick exactly one digit from each blocks, such that the resulting integer equals k modulo x.


-----Examples-----
Input
12 1 5 10
3 5 6 7 8 9 5 1 1 1 1 5

Output
3

Input
3 2 1 2
6 2 2

Output
0

Input
3 2 1 2
3 1 2

Output
6



-----Note-----

In the second sample possible integers are 22, 26, 62 and 66. None of them gives the remainder 1 modulo 2.

In the third sample integers 11, 13, 21, 23, 31 and 33 have remainder 1 modulo 2. There is exactly one way to obtain each of these integers, so the total answer is 6.

Source: codeforces | Difficulty: HARD
Tags: Matrices

Dynamic programming


Solutions:
R = lambda : map(int, input().split())
(n, b, k, x) = R()
v = list(R())
mod = 10 ** 9 + 7
arr_0 = [0] * x
for bd in v:
	arr_0[bd % x] += 1

def cross(arr1, arr2, x, mod):
	arr = [0] * len(arr1)
	for i in range(len(arr1)):
		for j in range(len(arr2)):
			arr[(i + j) % x] += arr1[i] * arr2[j]
	for i in range(len(arr)):
		arr[i] %= mod
	return arr

def move(arr, s, x):
	m = pow(10, s, x)
	res = [0] * x
	for i in range(x):
		res[i * m % x] += arr[i]
	return res

def solve(b, x, arr_0, mod):
	if b == 1:
		return arr_0
	if b % 2 == 1:
		sol = solve(b - 1, x, arr_0, mod)
		return cross(move(sol, 1, x), arr_0, x, mod)
	else:
		sol = solve(b // 2, x, arr_0, mod)
		return cross(move(sol, b // 2, x), sol, x, mod)
sol = solve(b, x, arr_0, mod)
print(sol[k])


(n, b, k, x) = map(int, input().split())
arr = list(map(int, input().split()))
flg = [0] * x
mod = 10 ** 9 + 7
for i in arr:
	flg[i % x] += 1

def mul(dp, flg, rank):
	nonlocal x
	res = [0] * x
	for i in range(x):
		for j in range(x):
			res[(i * rank % x + j) % x] += dp[i] * flg[j] % mod
			res[(i * rank % x + j) % x] %= mod
	return res

def pow(n):
	nonlocal x
	res = 1
	base = 10
	while n:
		if n & 1:
			res = res * base % x
		base = base * base % x
		n >>= 1
	return res
dp = [0] * x
dp[0] = 1
rank = 1
while b:
	if b & 1:
		dp = mul(dp, flg, pow(rank))
	flg = mul(flg, flg, pow(rank))
	rank <<= 1
	b >>= 1
print(dp[k])


def g(b, w):
	if (b, w) in x:
		return x[b, w]
	x[b, w] = sum((c[i] for i in r(len(c)) if i % m == w)) if b == 1 else sum((g(b // 2, l) * g(b - b // 2, (w - l * pow(10, b - b // 2, m) % m + m) % m) for l in r(m))) % (10 ** 9 + 7)
	return x[b, w]
(q, r, k) = (input, range, 'map(int,q().split())')
(n, b, w, m) = eval(k)
(a, x) = (list(eval(k)), {})
c = [a.count(i) for i in r(10)]
print(g(b, w))


f = lambda : map(int, input().split())
m = 1000000007
(n, b, k, x) = f()
s = [0] * x
for q in f():
	s[q % x] += 1

def g(t, d):
	if not t:
		return s
	p = [0] * x
	for (i, a) in enumerate(t):
		for (j, b) in enumerate(s):
			p[(i + d * j) % x] += a * b
	return [q % m for q in p]
t = []
(u, v) = (1, 10)
while b:
	if b & 1:
		t = g(t, u)
		u = v * u % x
	s = g(s, v)
	v = v * v % x
	b >>= 1
print(t[k])


import os
from io import BytesIO

def main():
	mod = 10 ** 9 + 7
	(n, b, k, x) = map(int, input().split())
	x2 = x + 1
	ai = list(map(int, input().split()))
	ai2 = [0] * x2
	for i in range(n):
		ai2[ai[i] % x] += 1
	ai2[-1] = 1

	def power2(number, n, m):
		res = 1
		while n:
			if n & 1:
				res *= number
				res %= m
			number *= number
			number %= m
			n >>= 1
		return res

	def mult(m1, m2):
		ans = [0] * x2
		for i in range(x):
			for j in range(x):
				temp = (i * power2(10, m2[-1], x) + j) % x
				ans[temp] += m1[i] * m2[j]
				ans[temp] %= mod
		ans[-1] = m1[-1] + m2[-1]
		return ans

	def power(number, n):
		res = number
		while n:
			if n & 1:
				res = mult(res, number)
			number = mult(number, number)
			n >>= 1
		return res
	ansm = power(ai2, b - 1)
	print(ansm[k])
main()


p = 10 ** 9 + 7
(n, b, k, x) = [int(s) for s in input().split()]
block = [int(s) for s in input().split()]
D = [0 for i in range(10)]
for s in block:
	D[s] += 1
A = [[0 for t in range(x)]]
pows = [pow(10, 1 << j, x) for j in range(b.bit_length())]
for i in range(10):
	A[0][i % x] += D[i]
for j in range(b.bit_length() - 1):
	B = A[-1]
	C = [sum((B[i] * B[(t - i * pows[j]) % x] for i in range(x))) % p for t in range(x)]
	A.append(C)
ans = None
for j in range(b.bit_length()):
	if b >> j & 1:
		if ans is None:
			ans = A[j][:]
		else:
			ans = [sum((A[j][(t - i * pows[j]) % x] * ans[i] for i in range(x))) % p for t in range(x)]
print(ans[k])