Under construction

Still being built. Things may change

Wooden Board

Time limit5sMemory limit1024 MB

Summary
Given N trees with daily growth chances in percent, find the expected area of the largest rectangle under the tree heights after M days, modulo 998244353.
Level

Medium7 of 10

Topics
Dynamic programming, Probability, Divide and conquer
Solved
No attempts yet

Problem

NN trees are planted in a straight line, each 11 unit apart.

On day 00, every tree has height 00. Each tree has width 11. At the start of each day, the ii-th tree grows by 11 compared to the previous day with probability pip_i percent. Otherwise, it keeps the same height as the previous day.

You want to cut the largest rectangular region covered by the NN trees to get a large wooden board. The two sides of the board must be parallel to the ground.

For example, when 5 trees are planted and their heights are 1, 4, 2, 5, 3 in order, the board size is 8.

Find the expected area of the wooden board you can obtain on day MM. See the Output section for the output format.

Input

The first line contains the number of trees NN and the number of days MM. (1≤N,M≤30)(1 \leq N, M \leq 30)

The second line contains the growth percentages p1,p2,⋯ ,pNp_1, p_2, \cdots, p_N of each tree per day. (1≤pi≤100)(1 \leq p_i \leq 100)

All input values are guaranteed to be integers.

Output

The expected area is a rational number. When it is written as an irreducible fraction yx\frac{y}{x}, xx is guaranteed not to be a multiple of 998 244 353998\,244\,353. Then there is exactly one integer 0≤z<998 244 3530 \leq z < 998\,244\,353 such that xz≡y(mod998 244 353)xz \equiv y \pmod{998\,244\,353}. Print this zz.

Examples2

  1. Example 1

    Input
    2 1
    50 50
    
    Expected output
    1
    
  2. Example 2

    Input
    5 5
    10 30 40 20 90
    
    Expected output
    529212766