There are N towns numbered 1 through N. There is a bidirectional road between towns i and i+1, and its length is D_i. Thus, for each pairs (a, b) (a<b), the distance between towns a and b is D(a,b)=D_a+D_a+1+…+D_b−1.
At each town there is a sugar shop. An ant wants to visit K distinct shops.
The ant wants to choose a set of K distinct shops and the order to visit them. For example, if it decides to visit the shops S_1,…,S_K in this order, the total distance it travels will be D(S_1,S_2)+D(S_2,S_3)+…+D(S_K−1,S_K).
In how many ways the total distance it travels become a multiple of M? Print the answer modulo 109+7.
N M K
D_1
D_2
⋮
D_N−1
Print the answer modulo 109+7.
In Sample 1, there are six ways: 1→3→2, 2→3→1, 2→1→4, 4→1→2, 2→3→4, and 4→3→2.