← Back to Problems
Counting Darts
Easy standard Combinatorics
Time limit: 3 s per test  ·  Memory: 256 MB

A dart board is divided into m regions. Region i is worth a_i points; several regions may be worth the same number of points, but they are still different regions. A player throws n darts, and every dart hits exactly one region.

Count the number of distinct throw sequences whose points add up to exactly the target T. Throws are ordered: hitting region 1 then region 2 is a different sequence from hitting region 2 then region 1 — and hitting two different regions of equal value also gives different sequences.

Since the count can be enormous, output it modulo 998244353.

Input

The first line contains n, m and T. The second line contains the m region values a_1 ... a_m.

Output

One integer: the number of sequences, modulo 998244353. If the target is unreachable, output 0.

Constraints

1 <= n <= 200

1 <= m <= 100

1 <= a_i <= 50

0 <= T <= 10000

Scoring

This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.

Examples

input
2 3 4
1 2 3
output
3
input
3 2 100
5 7
output
0
Python 3.13 i Execution environment Isolated microVM · 1 vCPU · no internet access Time and memory limits are set per problem Available packages numpy 2.5.0scipy 1.18.0pandas 3.0.0scikit-learn 1.9.0statsmodels 0.15.0cvxpy 1.9.2