Travel in Sugar Country

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

There are NN towns numbered 11 through NN. There is a bidirectional road between towns ii and i+1i+1, and its length is D_iD\_i. Thus, for each pairs (aa, bb) (a<ba < b), the distance between towns aa and bb is D(a,b)=D_a+D_a+1++D_b1D(a, b) = D\_a + D\_{a+1} + \ldots + D\_{b-1}.

At each town there is a sugar shop. An ant wants to visit KK distinct shops.

The ant wants to choose a set of KK distinct shops and the order to visit them. For example, if it decides to visit the shops S_1,,S_KS\_1, \ldots, S\_K in this order, the total distance it travels will be D(S_1,S_2)+D(S_2,S_3)++D(S_K1,S_K)D(S\_1, S\_2) + D(S\_2, S\_3) + \ldots + D(S\_{K-1}, S\_K).

In how many ways the total distance it travels become a multiple of MM? Print the answer modulo 109+710^9+7.

입력

NN MM KK
D_1D\_1
D_2D\_2
\vdots
D_N1D\_{N-1}

출력

Print the answer modulo 109+710^9+7.

제한

  • 2N1002 \leq N \leq 100
  • 1M301 \leq M \leq 30
  • 2K10,KN2 \leq K \leq 10, K \leq N
  • 1D_iM1 \leq D\_i \leq M
  • All values in the input are integers.

힌트

In Sample 1, there are six ways: 1321 \rightarrow 3 \rightarrow 2, 2312 \rightarrow 3 \rightarrow 1, 2142 \rightarrow 1 \rightarrow 4, 4124 \rightarrow 1 \rightarrow 2, 2342 \rightarrow 3 \rightarrow 4, and 4324 \rightarrow 3 \rightarrow 2.