Smooth numbers#1795

Smooth numbers

1 second
128 megabytes
Medium

A number is called smooth if its digits, starting from the most significant digit, form a non-decreasing sequence. Arrange all such numbers in increasing order and assign each a position. Given , output the -th smooth number.

Input

A single integer (1 \leq n \leq 2147483647).

Output

Print the smooth number at position .

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading