#P13679. [IAMOI R2] 传奇模数

    ID: 13441 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>数学洛谷原创O2优化洛谷月赛

[IAMOI R2] 传奇模数

Description

In OI competitions, modular operation is indispensable. Among various prime numbers, 998244353998244353 possesses excellent properties and is frequently used as a modulus.

Little Y adores OI and particularly enjoys integer division and modular operations. He provides you with an integer nn and requests you to compute:

$$\left(\left\lfloor\frac{1}{998244353}\right\rfloor + \left\lfloor\frac{2}{998244353}\right\rfloor + \cdots + \left\lfloor\frac{n}{998244353}\right\rfloor\right) \bmod 998244353$$

Input Format

A single line containing one positive integer nn.

Output Format

Output an integer representing the answer.

998244353
1
1145141919810
839522406

Hint

【Data Range】

  • For 40%40\% of the data, 1n1091 \le n \le 10^9.
  • For 70%70\% of the data, 1n10151 \le n \le 10^{15}.
  • For 100%100\% of the data, 1n10181 \le n \le 10^{18}.