Under construction

Still being built. Things may change

Village Planning

Time limit3sMemory limit1024 MB

Summary
For each N from 2 to M, sum the product of A[f(i,j)] over all labeled simple graphs on N houses, where f counts simple paths and at most K are allowed.
Level

Hard9 of 10

Topics
Graph, Combinatorics, Dynamic programming
Solved
No attempts yet

Problem

As the mayor of the RUN town, you are planning to build a new village. The village consists of houses and roads connecting two different houses. No two roads connect the same pair of houses. In other words, the village can be treated as a simple graph, where each house is a vertex and each road is an edge. The village may be disconnected.

You want your village to be as simple as possible. Therefore, for any distinct houses ii and jj, there should be at most KK simple paths from house ii to house jj.

Let NN be the number of houses. The score of the village is ∏1≤i<j≤NAf(i,j)\prod_{1\le i<j\le N} A_{f(i,j)}, where f(i,j)f(i,j) is the number of simple paths from house ii to house jj.

The number of houses is not yet determined, but it is an integer between 22 and MM. For each NN from 22 to MM, calculate the sum of the scores of all possible villages with NN houses.

Since the answers can be large, output them modulo 998244353998244353.

Input

The first line contains two space-separated integers MM and KK.

The second line contains K+1K+1 space-separated integers A0,…,AKA_0, \dots, A_K.

Output

For each NN from 22 to MM, output the sum of the scores of all possible villages with NN houses, modulo 998244353998244353. The answers are separated by a space.

Constraints

  • 2≤M≤1000002\leq M\leq 100000
  • 0≤K≤30\leq K\leq 3
  • 1≤Ai<9982443531\leq A_i<998244353 (0≤i≤K)(0\le i\le K)

Examples4

  1. Example 1

    Input
    4 0
    2
    
    Expected output
    2 8 64
    
  2. Example 2

    Input
    5 1
    3 4
    
    Expected output
    7 327 96721 169832849
    
  3. Example 3

    Input
    6 2
    5 6 7
    
    Expected output
    11 1566 3000672 306031599 466869291
    
  4. Example 4

    Input
    7 3
    8 9 10 11
    
    Expected output
    17 5427 31856976 326774674 449014006 997476587