103573: [Atcoder]ABC357 D - 88888888

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:14 Solved:0

Description

Score : $350$ points

Problem Statement

For a positive integer $N$, let $V_N$ be the integer formed by concatenating $N$ exactly $N$ times.
More precisely, consider $N$ as a string, concatenate $N$ copies of it, and treat the result as an integer to get $V_N$.
For example, $V_3=333$ and $V_{10}=10101010101010101010$.

Find the remainder when $V_N$ is divided by $998244353$.

Constraints

  • $1 \leq N \leq 10^{18}$
  • $N$ is an integer.

Input

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

$N$

Output

Print the remainder when $V_N$ is divided by $998244353$.


Sample Input 1

5

Sample Output 1

55555

The remainder when $V_5=55555$ is divided by $998244353$ is $55555$.


Sample Input 2

9

Sample Output 2

1755646

The remainder when $V_9=999999999$ is divided by $998244353$ is $1755646$.


Sample Input 3

10000000000

Sample Output 3

468086693

Note that the input may not fit into a $32$-bit integer type.

Output

得分:$350$ 分 #### 问题描述 给定一个正整数 $N$,$V_N$ 是由 $N$ 重复拼接 $N$ 次得到的整数。 具体来说,将 $N$ 视为字符串,拼接 $N$ 个自身,然后将结果作为整数看待,从而得到 $V_N$。 例如,$V_3=333$,$V_{10}=10101010101010101010$。 请找出 $V_N$ 除以 $998244353$ 的余数。 #### 限制条件 - $1 \leq N \leq 10^{18}$ - $N$ 是一个整数。 #### 输入 标准输入提供如下格式的数据: ``` $N$ ``` #### 输出 打印 $V_N$ 除以 $998244353$ 的余数。 #### 样例输入 1 ``` 5 ``` #### 样例输出 1 ``` 55555 ``` 当 $V_5=55555$ 除以 $998244353$ 的余数为 $55555$。 #### 样例输入 2 ``` 9 ``` #### 样例输出 2 ``` 1755646 ``` 当 $V_9=999999999$ 除以 $998244353$ 的余数为 $1755646$。 #### 样例输入 3 ``` 10000000000 ``` #### 样例输出 3 ``` 468086693 ``` 注意,输入可能无法容纳在 $32$ 位整数类型中。

加入题单

上一题 下一题 算法标签: