CPython lite logoProblemsContests

39. Sum of Digits. Inverse Problem #2

Find the smallest number that equals the sum of digits n.


Input

The first line contains a natural number,  n(1n1000).

Output

The unique line contains the solution to the problem.


Sample input 1

5

Sample output 1

5

Sample input 2

10

Sample output 2

19

Sample input 3

18

Sample output 3

99

Login to be able to submit.

NormalMathLoops
155 / 43
Solved / unsolved count
0.5 s / 512 MB
Limits