#5745. [NWRRC 2023] Divisibility Trick

[NWRRC 2023] Divisibility Trick

[NWRRC 2023] Divisibility Trick

题目描述

Dmitry has recently learned a simple rule to check if an integer is divisible by 3. An integer is divisible by 3 if the sum of its digits is divisible by 3.

Later he also learned that the same rule can be used to check if an integer is divisible by 9. An integer is divisible by 9 if the sum of its digits is divisible by 9.

Dmitry's elder sister Daria wants to trick him by showing that the same rule can be applied to any divisor~dd. To do this, she wants to show Dmitry an example of a positive integer nn such that nn is divisible by dd, and the sum of the digits of nn is also divisible by dd. Help her to find such a number.

输入格式

The only line contains a single integer $d$ ($1\le d\le 1000$).

输出格式

Print a positive integer $n$ divisible by $d$ such that the sum of its digits is also divisible by $d$.

The value of nn must consist of at most 10610^6 digits and must not have leading zeroes. It can be shown that such an integer always exists. If there are multiple answers, print any of them.

3
3
13
1898
1
239

提示

In the first example, $3$ is divisible by $3$, and its sum of digits, $3$, is also divisible by $3$.

In the second example, 18981898 is divisible by 1313, and its sum of digits, 1+8+9+8=261 + 8 + 9 + 8 = 26, is also divisible by 1313.

In the third example, any positive integer satisfies the conditions. 标签: P13584|2023|Special Judge|鸽笼原理|ICPC|NWRRC

来源

P13584|[NWRRC 2023] Divisibility Trick