#C7830. Smallest Number with Given Digit Sum

    ID: 51745 Type: Default 1000ms 256MiB

Smallest Number with Given Digit Sum

Smallest Number with Given Digit Sum

Given a positive integer (n), find the smallest positive integer (X) such that the sum of its digits is equal to (n).

In other words, determine the minimum (X) satisfying [ \text{sum_digits}(X) = n ] where (\text{sum_digits}(X)) represents the sum of all digits of (X).

inputFormat

A single integer (n) ((1 \leq n \leq 10^3)) provided via standard input.

outputFormat

Output the smallest positive integer (X) whose digits add up to (n), printed to standard output.## sample

15
69