atcoder#ABC243F. [ABC243F] Lottery

[ABC243F] Lottery

Score : 500500 points

Problem Statement

Takahashi is participating in a lottery.

Each time he takes a draw, he gets one of the NN prizes available. Prize ii is awarded with probability Wij=1NWj\frac{W_i}{\sum_{j=1}^{N}W_j}. The results of the draws are independent of each other.

What is the probability that he gets exactly MM different prizes from KK draws? Find it modulo 998244353998244353.

Note

To print a rational number, start by representing it as a fraction yx\frac{y}{x}. Here, xx and yy should be integers, and xx should not be divisible by 998244353998244353 (under the Constraints of this problem, such a representation is always possible). Then, print the only integer zz between 00 and 998244352998244352 (inclusive) such that xzy(mod998244353)xz\equiv y \pmod{998244353}.

Constraints

  • 1K501 \leq K \leq 50
  • 1MN501 \leq M \leq N \leq 50
  • 0<Wi0 < W_i
  • 0<W1++WN<9982443530 < W_1 + \ldots + W_N < 998244353
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM KK

W1W_1

\vdots

WNW_N

Output

Print the answer.

2 1 2
2
1
221832079

Each draw awards Prize 11 with probability 23\frac{2}{3} and Prize 22 with probability 13\frac{1}{3}.

He gets Prize 11 at both of the two draws with probability 49\frac{4}{9}, and Prize 22 at both draws with probability 19\frac{1}{9}, so the sought probability is 59\frac{5}{9}.

The modulo 998244353998244353 representation of this value, according to Note, is 221832079221832079.

3 3 2
1
1
1
0

It is impossible to get three different prizes from two draws, so the sought probability is 00.

3 3 10
499122176
499122175
1
335346748
10 8 15
1
1
1
1
1
1
1
1
1
1
755239064