Jump Jump Jump

좌표가 음이 아닌 k개의 서로 다른 점프 벡터가 주어질 때, (0,0)에서 출발한 토끼가 각 x에 대해 대각선 점 (x,x)에 처음으로 갇힐 확률을 n까지 구한다.

어려움8동적 계획법조합론수학확률아직 제출이 없습니다시간 제한5초메모리 제한512 MB

문제

The rabbit starts at point (0,0)(0, 0) on the plane. The are kk distinct vectors (dx_1,dy_1)(dx\_1, dy\_1), (dx_2,dy_2)(dx\_2, dy\_2), \ldots, (dx_k,dy_k)(dx\_k, dy\_k). On each step, the rabbit will choose one vector (dx_c,dy_c)(dx\_c, dy\_c) randomly with the same probability, and then jump from its current point (x,y)(x, y) to (x+dx_c,y+dy_c)(x + dx\_c, y + dy\_c). All choices are independent.

There are traps in all the lattice points (x,x)(x, x) for all x1x \geq 1. Once the rabbit jumps into a trap, it gets trapped and can not move anymore.

For each xx such that 1xn1 \leq x \leq n, output the probability that the rabbit gets trapped in the lattice point (x,x)(x, x).

입력

The first line contains two integers nn and kk (1n1051 \leq n \leq 10^5, 1k161 \leq k \leq 16).

Each of the following kk lines contains two integers dx_idx\_i and dy_idy\_i (0dx_i,dy_i30 \leq dx\_i, dy\_i \leq 3) in each line. All the vectors are distinct.

출력

Print nn lines. On line xx, print the probability that the rabbit is trapped in the lattice point (x,x)(x, x). It is guaranteed that the probability can be represented as a fraction A/BA / B where BB is coprime to 998,244,353998\\,244\\,353, so output it as AB1mod998,244,353A \cdot B^{-1} \bmod 998\\,244\\,353.

힌트

The probabilities are 12,18,116,5128,and7256\frac{1}{2}, \frac{1}{8}, \frac{1}{16}, \frac{5}{128}, and \frac{7}{256}.