409009: GYM103415 A Math Ball

Memory Limit:512 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Math Balltime limit per test1.5 smemory limit per test512 megabytesinputstandard inputoutputstandard output

Cake has $$$n$$$ types of balls numbered from $$$1$$$ to $$$n$$$, the $$$i$$$-th type of which has a sufficient number of indistinguishable balls and a cost $$$c_i$$$. Cake wants to take away some of them, but his backpack can only carry at most $$$W$$$ balls. Simple knapsack problem cannot please Cake, so he wants to add some magic to the balls. Formally, if he takes $$$k_i$$$ balls from the $$$i$$$-th type, the cost is $$$C=k_1^{c_1}k_2^{c_2}\ldots k_n^{c_n}$$$. We wants know for all possible plans taking at most $$$W$$$ balls, what the total cost modulo 998244353 is.

Input

First line contains two integers $$$n$$$ and $$$W$$$, and the second line contains $$$n$$$ integers $$$c_1, c_2, \ldots c_n$$$, separated by space.

It is guaranteed that $$$n\le 10^5$$$, $$$W\le 10^{18}$$$, and $$$\sum c_i\le 10^5$$$.

Output

Print the total cost modulo 998244353.

ExampleInput
4 5
1 2 3 4
Output
31
Note

For the sample input, plans $$$(k_1,k_2,k_3,k_4)$$$ with non-zero costs are $$$(1, 1, 1, 2)$$$, $$$(1, 1, 2, 1)$$$, $$$(1, 2, 1, 1)$$$, $$$(2, 1, 1, 1)$$$, and $$$(1, 1, 1, 1)$$$, and the total cost is $$$2^4+2^3+2^2+2^1+1=31$$$.

加入题单

算法标签: