AtCoder Beginner Contest 390
G
Permutation Concatenation
AtCoder
⌀ 2508
原题
翻译中…

Problem Statement

翻译中…

You are given a positive integer $N$.

翻译中…

For an integer sequence $A=(A_1,A_2,\ldots,A_N)$ of length $N$. Let $f(A)$ be the integer obtained as follows:

翻译中…
  • Let $S$ be an empty string.
  • For $i=1,2,\ldots,N$ in this order:
  • Let $T$ be the decimal representation of $A_i$ without leading zeros.
    • Append $T$ to the end of $S$.
  • Interpret $S$ as a decimal integer, and let that be $f(A)$.
翻译中…

For example, if $A=(1,20,34)$, then $f(A)=12034$.

翻译中…

There are $N!$ permutations $P$ of $(1,2,\ldots,N)$. Find the sum, modulo $998244353$, of $f(P)$ over all such permutations $P$.

翻译中…

Constraints

翻译中…
  • $1 \le N \le 2 \times 10^5$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the sum, modulo $998244353$, of $f(P)$ over all permutations $P$ of $(1,2,\ldots,N)$.

翻译中…

样例

Input #1
3
Output #1
1332
The six permutations of $(1,2,3)$ are $(1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2), (3,2,1)$. Their $f(P)$ values are $123,132,213,231,312,321$. Therefore, print $123+132+213+231+312+321 = 1332$.
Input #2
390
Output #2
727611652
Print the sum modulo $998244353$.
Input #3
79223
Output #3
184895744
题目信息
题号
abc390_g
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。