P17637 [ICPC 2019 Yinchuan R] Function!

Description

Define the function $$ f_a(x) = a^x \quad (a > 0 \land 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}(b) \rfloor \lceil f_{b}^{-1}(a) \rceil \right) $$ where $f_a^{-1}(x)$ is the inverse function of $f_a(x)$, $\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 Format

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

Output Format

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