For a nonnegative integer $$$x$$$, let $$$f(x)$$$ and $$$g(x)$$$ denote the digit sum of $$$x$$$ in binary and ternary, respectively.
Given $$$n, a, b, c$$$, compute $$$$$$\left(\sum_{i=1}^n a^i b^{f(i)} c^{g(i)} \right) \bmod 998244353.$$$$$$
In the first line, $$$n, a, b, c$$$ ($$$1\leq n\leq 10^{13}, 1\leq a, b, c \lt 998244353$$$).
One integer — the answer.
123456 12345 234567 3456789
664963464
9876543210987 12816 837595 128478
7972694
| Name |
|---|


