Divisibility Trick

시간 제한2초메모리 제한1024 MB

요약
d가 주어질 때, d로 나누어지면서 각 자리 숫자의 합도 d로 나누어지는 양의 정수 n을 아무거나 출력한다.
난이도

보통10점 중 4점

유형
수학, 정수론, 구현
정답자
아직 제출이 없습니다

문제

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 dd (1≤d≤10001\le d\le 1000).

출력

Print a positive integer nn divisible by dd such that the sum of its digits is also divisible by dd.

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.

힌트

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

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.

예제3

  1. 예제 1

    입력
    3
    
    예상 출력
    3
    
  2. 예제 2

    입력
    13
    
    예상 출력
    1898
    
  3. 예제 3

    입력
    1
    
    예상 출력
    239