410434: GYM104021 F Function!

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Function!time limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

Define the function

$$$$$$ f_a\left( x \right) = a^x~(a > 0 \wedge a \neq 1) $$$$$$

for all $$$x \in (-\infty, +\infty)$$$.

You are asked to calculate the value of

$$$$$$ \sum_{a=2}^n{\left( a \sum_{b=a}^n{\lfloor f_{a}^{-1}\left( b \right) \rfloor}\lceil f_{b}^{-1}\left( a \right) \rceil \right)} $$$$$$

where $$$f_a^{-1}\left( x \right)$$$ is the inverse function of $$$f_a\left( x \right)$$$, $$$\lfloor x \rfloor$$$ is the largest integer that is less than or equal to $$$x$$$, and $$$\lceil x \rceil$$$ is the smallest integer that is greater than or equal to $$$x$$$.

Since the value could be very large, please output the value modulo $$$998244353$$$.

Input

An integer $$$n~(2 \leq n \leq 10^{12})$$$ described above.

Output

An integer denotes the value you have calculated modulo $$$998244353$$$.

ExamplesInput
2
Output
2
Input
10
Output
236

加入题单

算法标签: