Under construction

Still being built. Things may change

Jump Jump Jump

Time limit5sMemory limit512 MB

Summary
Given k jump vectors with coordinates up to 3, find for each x up to n the probability that a random walk from (0, 0) first lands on the diagonal point (x, x).
Level

Hard9 of 10

Topics
Probability, Dynamic programming, Math
Solved
No attempts yet

Problem

The rabbit starts at point (0,0)(0, 0) on the plane. There are kk distinct vectors (dx1,dy1),(dx2,dy2),…,(dxk,dyk)(dx_1, dy_1), (dx_2, dy_2), \ldots, (dx_k, dy_k). On each step, the rabbit chooses one vector (dxc,dyc)(dx_c, dy_c) with equal probability and jumps from its current point (x,y)(x, y) to (x+dxc,y+dyc)(x + dx_c, y + dy_c). All choices are independent.

There are traps at all lattice points (x,x)(x, x) for x≥1x \geq 1. Once the rabbit jumps into a trap, it is trapped and cannot move anymore.

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

Input

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

Each of the following kk lines contains two integers dxidx_i and dyidy_i (0≤dxi,dyi≤30 \leq dx_i, dy_i \leq 3). All the vectors are distinct.

Output

Print nn lines. On line xx, print the probability that the rabbit is trapped at the lattice point (x,x)(x, x).

It is guaranteed that the probability can be written as a fraction A/BA / B where BB is coprime to 998244353. Print A⋅B−1 mod 998244353A \cdot B^{-1} \bmod 998244353.

Hint

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

Examples1

  1. Example 1

    Input
    5 3
    0 0
    0 1
    1 0
    
    Expected output
    499122177
    873463809
    935854081
    959250433
    970948609