#P10670. Summation Modulo

    ID: 12698 Type: Default 1000ms 256MiB

Summation Modulo

Summation Modulo

Compute the following sum modulo \(998244353\):

\[ S = \sum_{n=1}^{N} \sum_{m=1}^{M} \sum_{k=0}^{m-1} \left\lfloor \frac{nk+x}{m} \right\rfloor \]

Here, \(x\) is a real number and \(N, M\) are positive integers. The symbol \(\lfloor y \rfloor\) denotes the greatest integer less than or equal to \(y\).

inputFormat

The input consists of three values separated by spaces: an integer (N), an integer (M), and a real number (x).

outputFormat

Output a single integer: the value of the sum modulo (998244353).

sample

1 1 5
5