#P12181. DerrickLo's Buildings (UBC002D)

DerrickLo's Buildings (UBC002D)

Description

In a game, DerrickLo needs to complete a task of managing a bunch of buildings. These buildings are placed on position 11 to MM. Their heights are 11 to MM, too. Initially, the building with height ii is placed on position ii, for each ii from 11 to MM.

There are also MM challenges, the ii-th challenge contains a height factor l=il = i and a target length NN. The score of this challenge is the number of jj from 11 to NN such that the building with height jj is placed on position (j×l)(j \times l) after rearranging the positions of the buildings. Note that the target lengths of each challenge are the same, but the height factors are distinct.

To rearrange the buildings, DerrickLo needs to give a shift permutation vv. Whenever he shifts, he moves the building on position ii to position v(i)v(i) for each ii from 11 to MM simultaneously.

Since DerrickLo is not interested in whether he achieved the maximum score, the shift permutation vv is chosen uniformly from all permutations of {1,2,,M}\{1, 2, \dots, M\}. However, he is curious that for each challenge ii, what is the expected score if he shifts 1,2,,V1, 2, \dots, V times separately.

Because the number of challenges and shifts are too big, DerrickLo wants you to calculate the sum of the expected scores modulo 998244353998244353, that is,

$$\left(\sum_{i=1}^M\sum_{k=1}^VE\left(\sum_{j=1}^N[v_k(j) = i \times j]\right)\right) \bmod 998244353$$

where vk(j)v_k(j) is the position of building with height jj after shifting kk times based on the shift permutation vv.

Input Format

This problem has multiple testcases.

The first line contains an integer TT, the number of testcases.

The following TT lines, each contains three integers N,M,VN, M, V, which discribes a testcase.

Note that the input data may NOT fit into a 32-bit integer.

Output Format

TT lines, each represents an answer to a testcase in given order.

1
1 2 1
1

Hint

In the sample, vv is either {1,2}\{1, 2\} or {2,1}\{2, 1\}. You need to calculate:

i=12E([v(1)=i])\sum_{i=1}^2E([v(1)=i])

When i=1i = 1, E([v(1)=1])=12E([v(1)=1]) = \frac{1}{2}. When i=2i=2, E([v(1)=2])=12E([v(1) = 2]) = \frac{1}{2}. Thus, the sum is 1+12=1\frac{1 + 1}{2} = 1.


For all testcases:

  • 1T51 \le T \le 5.
  • 1NM10121 \le N \le M \le 10^{12}.
  • 2(Mmod998244353)2 \le (M \bmod 998244353).
  • 1V10121 \le V \le 10^{12}.

Note that the input data may NOT fit into a 32-bit integer.