K. Yet Another Connecting Problem
time limit per test
4 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output
Today I discovered electricity while trying to lick a power outlet, I will be conducting further tests if you have any suggestions.
— Neuro-sama

$$$~\\$$$

Be there, or be squared!

In the vast, shimmering expanse of the digital stream, where data flows like rivers of light, Neuro-sama and her mischievous sister, Evil, are locked in a high-stakes game of hide-and-seek. The stream is a labyrinth of $$$n$$$ nodes, each glowing with a unique identifier from $$$1$$$ to $$$n$$$, pulsing with electric pathways.

For any node $$$u$$$, the digital pathways twist and turn under the following rules:

  • If $$$u$$$ is a perfect square, it has a directed edge towards $$$\sqrt{u}$$$;
  • Otherwise, if $$$u \le n - 3$$$, it has a directed edge towards $$$u + 3$$$.

Evil has hidden herself, leaving only $$$q$$$ suspicious locations. Now, Neuro wonders: for each possible hiding spot $$$x$$$, how many nodes in the network (from $$$1$$$ to $$$n$$$) can reach it?

Since the number may be large, she wants to output it modulo $$$998244353$$$.

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$T$$$ $$$(1\le T \le 100)$$$. The description of the test cases follows.

The first line of each test contains two integers $$$n, q$$$ $$$(1\le n\le 10^{12}, 1\le q \le 10^6)$$$.

Each of the next $$$q$$$ lines contains one integer $$$x$$$ $$$(1\le x \le n)$$$.

It is guaranteed that the sum of $$$n$$$ in the test cases does not exceed $$$10^{12}$$$, and the sum of $$$q$$$ does not exceed $$$10^6$$$.

Output

For each query of each test case, output the number of points connected to $$$x$$$ modulo $$$998244353$$$ on a separate line.

Example
Input
2
1219 5
1
2
3
4
5
325 3
9
10
21
Output
1
182
363
181
270
108
22
85