#P4707. 重返现世

重返现世

Description

To open the gate back to the real world, Yopilla needs to craft the key that unlocks it. On the Lost Continent where Yopilla is, there are nn kinds of materials. As long as he gathers any kk kinds, he can start crafting.

Yopilla arrives at the core area of the Lost Continent. In each unit of time, this area will randomly generate one kind of material. The probability of generating the ii-th kind of material is pim\frac{p_i}{m}. If Yopilla does not have this material, then he can collect it.

Yopilla urgently wants to know the expected time for him to collect any kk kinds of materials. Output the answer modulo 998244353998244353.

Input Format

The first line contains three integers n,k,mn, k, m.

The second line contains nn integers p1,p2,...,pnp_1, p_2, ..., p_n.

Output Format

Output one line.

3 3 3
1 1 1

499122182

Hint

For 10%10\% of the testdata, p1=p2=...=pmp_1 = p_2 = ... = p_m.

For another 10%10\% of the testdata, k=nk = n.

For 70%70\% of the testdata, n100n \le 100.

For 100%100\% of the testdata, 1n10001 \le n \le 1000, 1kn1 \le k \le n, nk10n - k \le 10, 1pim1 \le p_i \le m, p=m\sum p = m, 1m100001 \le m \le 10000

Translated by ChatGPT 5